1# Scrollable Component Common APIs
2
3The common attributes and events for scrollable components currently only support the [List](ts-container-list.md), [Grid](ts-container-grid.md), [Scroll](ts-container-scroll.md), and [WaterFlow](ts-container-waterflow.md) components.
4
5>  **NOTE**
6>
7>  The initial APIs of this module are supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
8
9## Attributes
10
11### scrollBar<sup>11+</sup>
12
13scrollBar(barState: BarState): T
14
15Sets the scrollbar state.
16
17**Atomic service API**: This API can be used in atomic services since API version 11.
18
19**System capability**: SystemCapability.ArkUI.ArkUI.Full
20
21**Parameters**
22
23| Name  | Type                                     | Mandatory| Description                                  |
24| -------- | ----------------------------------------- | ---- | -------------------------------------- |
25| barState | [BarState](ts-appendix-enums.md#barstate) | Yes  | Scrollbar state.<br>Default value: **BarState.Auto** for the **List**, **Grid**, and **Scroll** components and **BarState.Off** for the **WaterFlow** component|
26
27### scrollBarColor<sup>11+</sup>
28
29scrollBarColor(color: Color | number | string): T
30
31Sets the scrollbar color.
32
33**Atomic service API**: This API can be used in atomic services since API version 11.
34
35**System capability**: SystemCapability.ArkUI.ArkUI.Full
36
37**Parameters**
38
39| Name| Type                                                        | Mandatory| Description          |
40| ------ | ------------------------------------------------------------ | ---- | -------------- |
41| color  | string \| number \| [Color](ts-appendix-enums.md#color) | Yes  | Scrollbar color.<br>Default value: **'\#182431'** (40% opacity)|
42
43### scrollBarWidth<sup>11+</sup>
44
45scrollBarWidth(value: number | string): T
46
47Sets the scrollbar width. This attribute cannot be set in percentage. After the width is set, the scrollbar is displayed with the set width in normal state and pressed state. If the set width exceeds the height of the scrollable component on the main axis, the scrollbar reverts to the default width.
48
49**Atomic service API**: This API can be used in atomic services since API version 11.
50
51**System capability**: SystemCapability.ArkUI.ArkUI.Full
52
53**Parameters**
54
55| Name| Type                      | Mandatory| Description                                     |
56| ------ | -------------------------- | ---- | ----------------------------------------- |
57| value  | string \| number | Yes  | Scrollbar width.<br>Default value: **4**<br>Unit: vp|
58
59### edgeEffect<sup>11+</sup>
60
61edgeEffect(edgeEffect: EdgeEffect, options?: EdgeEffectOptions): T
62
63Sets the effect used when the scroll boundary is reached.
64
65**Atomic service API**: This API can be used in atomic services since API version 11.
66
67**System capability**: SystemCapability.ArkUI.ArkUI.Full
68
69**Parameters**
70
71| Name               | Type                                             | Mandatory| Description                                                        |
72| --------------------- | ------------------------------------------------- | ---- | ------------------------------------------------------------ |
73| edgeEffect            | [EdgeEffect](ts-appendix-enums.md#edgeeffect)     | Yes  | Effect used when the scroll boundary is reached. The spring and shadow effects are supported.<br>Default value: **EdgeEffect.None** for the **Grid**, **Scroll**, and **WaterFlow** components and **EdgeEffect.Spring** for the **List** component|
74| options | [EdgeEffectOptions](#edgeeffectoptions11) | No  | Whether to enable the scroll effect when the component content is smaller than the component itself. The value **{ alwaysEnabled: true }** means to enable the scroll effect, and **{ alwaysEnabled: false }** means the opposite.<br>Default value:<br>**{ alwaysEnabled: false }** for the **List**, **Grid**, and **WaterFlow** components, and **{ alwaysEnabled: true }** for the **Scroll** component|
75
76### nestedScroll<sup>11+</sup>
77
78nestedScroll(value: NestedScrollOptions): T
79
80Sets the nested scrolling options. You can set the nested scrolling mode in the forward and backward directions to implement scrolling linkage with the parent component.
81
82**Atomic service API**: This API can be used in atomic services since API version 11.
83
84**System capability**: SystemCapability.ArkUI.ArkUI.Full
85
86**Parameters**
87
88| Name| Type                                                 | Mandatory| Description          |
89| ------ | ----------------------------------------------------- | ---- | -------------- |
90| value  | [NestedScrollOptions](#nestedscrolloptions10) | Yes  | Nested scrolling options.|
91
92### enableScrollInteraction<sup>11+</sup>
93
94enableScrollInteraction(value: boolean): T
95
96Sets whether to support scroll gestures. When this attribute is set to **false**, scrolling by finger or mouse is not supported, but the scroll controller API is not affected.
97
98**Atomic service API**: This API can be used in atomic services since API version 11.
99
100**System capability**: SystemCapability.ArkUI.ArkUI.Full
101
102**Parameters**
103
104| Name| Type   | Mandatory| Description                               |
105| ------ | ------- | ---- | ----------------------------------- |
106| value  | boolean | Yes  | Whether to support scroll gestures.<br>Default value: **true**|
107
108### friction<sup>11+</sup>
109
110friction(value: number | Resource): T
111
112Sets the friction coefficient. It applies only to gestures in the scrolling area, and it affects only indirectly the scroll chaining during the inertial scrolling process. If this attribute is set to a value less than or equal to 0, the default value is used.
113
114**Atomic service API**: This API can be used in atomic services since API version 11.
115
116**System capability**: SystemCapability.ArkUI.ArkUI.Full
117
118**Parameters**
119
120| Name| Type                                                | Mandatory| Description                                                     |
121| ------ | ---------------------------------------------------- | ---- | --------------------------------------------------------- |
122| value  | number \| [Resource](ts-types.md#resource) | Yes  | Friction coefficient.<br>Default value: **0.9** for wearable devices and **0.6** for non-wearable devices<br>Since API version 11, the default value for non-wearable devices is **0.7**.<br>Since API version 12, the default value for non-wearable devices is **0.75**.|
123
124### flingSpeedLimit<sup>11+</sup>
125
126flingSpeedLimit(speedLimit: number): T
127
128Sets the maximum initial velocity at the start of the fling animation that occurs after gesture-driven scrolling ends. If this attribute is set to a value less than or equal to 0, the default value is used.
129
130**Atomic service API**: This API can be used in atomic services since API version 11.
131
132**System capability**: SystemCapability.ArkUI.ArkUI.Full
133
134**Parameters**
135
136| Name    | Type  | Mandatory| Description                           |
137| ---------- | ------ | ---- | ------------------------------- |
138| speedLimit | number | Yes  | Maximum initial velocity at the start of the fling animation.<br>Default value: **12000**<br>Unit: vp/s|
139
140### fadingEdge<sup>14+</sup>
141
142fadingEdge(enabled: Optional&lt;boolean&gt;, options?: FadingEdgeOptions): T
143
144Sets whether to enable the edge fading effect and the length of the fading edge.
145
146**Atomic service API**: This API can be used in atomic services since API version 14.
147
148**System capability**: SystemCapability.ArkUI.ArkUI.Full
149
150**Parameters**
151
152| Name | Type                                             | Mandatory| Description                                                        |
153| ------- | ------------------------------------------------- | ---- | ------------------------------------------------------------ |
154| enabled | Optional&lt;boolean&gt;                           | Yes  | Whether to enable the edge fading effect.<br>When **fadingEdge** is set to **true**, it overrides the **.overlay()** attribute of the component.<br>With **fadingEdge** set to **true**, avoid setting background-related attributes on the component, as this may affect the display of the fading effect.<br>With **fadingEdge** set to **true**, the component is clipped to the boundary, and setting the component's **clip** attribute to **false** will not take effect.<br>Default value: **false**|
155| options | [FadingEdgeOptions](#fadingedgeoptions14) | No  | Object defining edge fading effect properties, such as the fading edge length.|
156
157### clipContent<sup>14+</sup>
158
159clipContent(clip: ContentClipMode | RectShape): T
160
161Sets the content clipping area for this scrollable component.
162
163**Atomic service API**: This API can be used in atomic services since API version 14.
164
165**System capability**: SystemCapability.ArkUI.ArkUI.Full
166
167**Parameters**
168
169| Name | Type                                             | Mandatory| Description                                                        |
170| ------- | ------------------------------------------------- | ---- | ------------------------------------------------------------ |
171| clip | [ContentClipMode](#contentclipmode14) \| [RectShape](../js-apis-arkui-shape.md#rectshape)   | Yes  | Clipping to apply, which is effective only for the content (that is, child components) of the scrollable component, not the background. When a custom rectangular area is passed through **RectShape**, only width, height, and [offset](../js-apis-arkui-shape.md#offset) relative to the component's upper left corner are supported, and rounded corners are not supported.<br></div>Default value: The default value for **Grid** and **Scroll** is **ContentClipMode.BOUNDARY**, and the default value for **List** and **WaterFlow** is **ContentClipMode.CONTENT_ONLY**.|
172
173
174## Events
175
176### onReachStart<sup>11+</sup>
177
178onReachStart(event: () => void): T
179
180Triggered when the scrollable component reaches the start position.
181
182This event is triggered once when the component is initialized and once when the component scrolls to the start position. If the edge effect is set to a spring effect, this event is triggered once when the swipe passes the start position, and triggered again when the swipe rebounds back to the start position.
183
184**Atomic service API**: This API can be used in atomic services since API version 11.
185
186**System capability**: SystemCapability.ArkUI.ArkUI.Full
187
188### onReachEnd<sup>11+</sup>
189
190onReachEnd(event: () => void): T
191
192Triggered when the scrollable component reaches the end position.
193
194If the edge effect is set to a spring effect, this event is triggered once when the swipe passes the end position, and triggered again when the swipe rebounds back to the end position.
195
196**Atomic service API**: This API can be used in atomic services since API version 11.
197
198**System capability**: SystemCapability.ArkUI.ArkUI.Full
199
200### onScrollStart<sup>11+</sup>
201
202onScrollStart(event: () => void): T
203
204Triggered when the scrollable component starts scrolling initiated by the user's finger dragging the component or its scrollbar. This event is also triggered when the animation contained in the scrolling triggered by [Scroller](ts-container-scroll.md#scroller) starts.
205
206**NOTE**
207
2081. This event is triggered when the scrollable component starts to scroll, and it supports various input methods that can initiate the scroll, including keyboard and mouse operations.
209
2102. This event is triggered when the controller API is called, accompanied by a transition animation.
211
212**Atomic service API**: This API can be used in atomic services since API version 11.
213
214**System capability**: SystemCapability.ArkUI.ArkUI.Full
215
216### onScrollStop<sup>11+</sup>
217
218onScrollStop(event: () => void): T
219
220Triggered when scrolling stops after the user's finger leaves the screen. This event is also triggered when the animation contained in the scrolling triggered by [Scroller](ts-container-scroll.md#scroller) stops.
221
222**NOTE**
223
2241. The event is triggered when the scrollable component stops scrolling, and it supports various input methods that can initiate the scroll, including keyboard and mouse operations.
225
2262. This event is triggered when the controller API is called, accompanied by a transition animation.
227
228**Atomic service API**: This API can be used in atomic services since API version 11.
229
230**System capability**: SystemCapability.ArkUI.ArkUI.Full
231
232### onWillScroll<sup>12+</sup>
233
234onWillScroll(handler: Optional&lt;OnWillScrollCallback&gt;): T
235
236Triggered when the scrollable component is about to scroll.
237
238The callback provides the amount of offset that is about to be scrolled in the current frame, along with the current scroll status and the source of the scrolling operation. The offset provided in the callback is the calculated intended scrolling offset, not the final actual scrolling offset. You can specify the intended scrolling offset for the scrollable component through the return value of this callback.
239
240**Atomic service API**: This API can be used in atomic services since API version 12.
241
242**System capability**: SystemCapability.ArkUI.ArkUI.Full
243
244**Parameters**
245
246| Name| Type| Mandatory| Description|
247| ------ | ------ | ------ | ------|
248| handler | Optional&lt;[OnWillScrollCallback](#onwillscrollcallback12)&gt; | Yes| Callback triggered when the scrollable component is about to scroll.|
249
250> **NOTE**
251>
252> When **ScrollEdge** and **ScrollToIndex** that does not involve animation is called, **onWillScroll** is not invoked.
253
254
255### onDidScroll<sup>12+</sup>
256
257onDidScroll(handler: OnScrollCallback): T
258
259Triggered when the scrollable component scrolls. The return value is the offset amount by which the list has scrolled and the current scroll state.
260
261**Widget capability**: This API can be used in ArkTS widgets since API version 12.
262
263**Atomic service API**: This API can be used in atomic services since API version 12.
264
265**System capability**: SystemCapability.ArkUI.ArkUI.Full
266
267**Parameters**
268
269| Name| Type| Mandatory| Description|
270| ------ | ------ | ------ | ------|
271| handler | [OnScrollCallback](#onscrollcallback12) | Yes| Callback triggered when the scrollable component scrolls.|
272
273### onScroll<sup>(deprecated)</sup>
274
275onScroll(event: (scrollOffset: number, scrollState: ScrollState) => void): T
276
277Triggered when the scrollable component scrolls.
278
279This API is supported since API version 11.
280
281This API is deprecated since API version 12. For the **Scroll** component, the **onScroll** event is triggered before layout calculations, and you are advised to use [onWillScroll](#onwillscroll12) instead. For the **List**, Grid, and **WaterFlow** components, the **onScroll** event is triggered after layout calculations, and you are advised to use [onDidScroll](#ondidscroll12) instead.
282
283**Atomic service API**: This API can be used in atomic services since API version 11.
284
285**System capability**: SystemCapability.ArkUI.ArkUI.Full
286
287**Parameters**
288
289| Name| Type| Mandatory| Description|
290| ------ | ------ | ------ | ------|
291| scrollOffset | number | Yes| Scroll offset of each frame. The offset is positive when the scrollable component is scrolled up and negative when it is scrolled down.<br>Unit: vp|
292| scrollState | [ScrollState](ts-container-list.md#scrollstate)| Yes| Current scroll state.|
293
294## ItemDragInfo
295
296**Atomic service API**: This API can be used in atomic services since API version 11.
297
298**System capability**: SystemCapability.ArkUI.ArkUI.Full
299
300| Name        | Type        |   Description        |
301| ---------- | ---------- | ---------- |
302| x | number |  X coordinate of the dragged item, in vp.   |
303| y | number |  Y coordinate of the dragged item, in vp.   |
304
305## NestedScrollOptions<sup>10+</sup>
306
307**Atomic service API**: This API can be used in atomic services since API version 11.
308
309**System capability**: SystemCapability.ArkUI.ArkUI.Full
310
311| Name  | Type | Mandatory| Description             |
312| ----- | ------ | ------ | ----------------- |
313| scrollForward | [NestedScrollMode](ts-appendix-enums.md#nestedscrollmode10) | Yes| Nested scrolling options when the scrollable component scrolls forward.|
314| scrollBackward | [NestedScrollMode](ts-appendix-enums.md#nestedscrollmode10) | Yes| Nested scrolling options when the scrollable component scrolls backward.|
315
316## EdgeEffectOptions<sup>11+</sup>
317
318**Atomic service API**: This API can be used in atomic services since API version 12.
319
320**System capability**: SystemCapability.ArkUI.ArkUI.Full
321
322| Name  | Type | Mandatory| Description             |
323| ----- | ------| ------- | ----------------- |
324| alwaysEnabled | boolean | Yes| Whether to enable the scroll effect when the component content is smaller than the component itself.|
325
326## FadingEdgeOptions<sup>14+</sup>
327
328**Atomic service API**: This API can be used in atomic services since API version 14.
329
330**System capability**: SystemCapability.ArkUI.ArkUI.Full
331
332| Name          | Type                                                        | Mandatory| Description                                                        |
333| ---------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
334| fadingEdgeLength | [LengthMetrics](../js-apis-arkui-graphics.md#lengthmetrics12) | No  | Length of the fading edge. If the value is smaller than 0, the default length, 32 vp, is used.<br>If the value exceeds half the height of the container, it is adjusted to exactly half the height of the container.|
335
336
337## ContentClipMode<sup>14+</sup>
338
339Enumerates the content clipping modes for the scrollable container.
340
341**Atomic service API**: This API can be used in atomic services since API version 14.
342
343**System capability**: SystemCapability.ArkUI.ArkUI.Full
344
345The figure below illustrates the clipping areas corresponding to each enumeration value after the component has been configured with margin and padding attributes.
346
347![ContentClipMode](figures/ContentClipMode.png)
348
349| Name    |  Value | Description                                      |
350| ------ | ------ | ---------------------------------------- |
351| CONTENT_ONLY   |  0  | Clip to the content area, corresponding to the green area in the figure.|
352| BOUNDARY |  1  | Clip to the component area, corresponding to the entire blue area in the figure.|
353| SAFE_AREA  |  2  | Clip to the safe area configured for the component, corresponding to the entire yellow area in the figure.|
354
355## OnWillScrollCallback<sup>12+</sup>
356
357type OnWillScrollCallback = (scrollOffset: number, scrollState: ScrollState, scrollSource: ScrollSource) => void | ScrollResult
358
359Callback triggered when the scrollable component is about to scroll.
360
361**Atomic service API**: This API can be used in atomic services since API version 12.
362
363**System capability**: SystemCapability.ArkUI.ArkUI.Full
364
365**Parameters**
366
367| Name| Type| Mandatory| Description|
368| ------ | ------ | ------ | ------|
369| scrollOffset | number | Yes| Scroll offset of each frame. The offset is positive when the scrollable component is scrolled up and negative when it is scrolled down.<br>Unit: vp|
370| scrollState | [ScrollState](ts-container-list.md#scrollstate)| Yes| Current scroll state.|
371| scrollSource | [ScrollSource](ts-appendix-enums.md#scrollsource12) | Yes| Source of the current scrolling operation.|
372
373**Return value**
374
375| Type                         | Description                                 |
376| ----------------------------- | ------------------------------------ |
377| void \| [ScrollResult](#scrollresult12) |  Returns a **ScrollResult** object if the scrollable component scrolls by the offset specified by you; returns no **ScrollResult** object if the component scrolls by the offset specified by **scrollOffset** in the callback.|
378
379## OnScrollCallback<sup>12+</sup>
380
381type OnScrollCallback = (scrollOffset: number, scrollState: ScrollState) => void
382
383Callback triggered when the scrollable component scrolls.
384
385**Widget capability**: This API can be used in ArkTS widgets since API version 12.
386
387**Atomic service API**: This API can be used in atomic services since API version 12.
388
389**System capability**: SystemCapability.ArkUI.ArkUI.Full
390
391| Name| Type| Mandatory| Description|
392| ------ | ------ | ------ | ------|
393| scrollOffset | number | Yes| Scroll offset of each frame. The offset is positive when the scrollable component is scrolled up and negative when it is scrolled down.<br>Unit: vp|
394| scrollState | [ScrollState](ts-container-list.md#scrollstate)| Yes| Current scroll state.|
395
396## ScrollResult<sup>12+</sup>
397
398**Atomic service API**: This API can be used in atomic services since API version 12.
399
400**System capability**: SystemCapability.ArkUI.ArkUI.Full
401
402| Name| Type| Mandatory| Description|
403| ------ | ------ | ------ | ------|
404| offsetRemain | number | Yes| Amount by which the component is about to be scrolled, in vp.|
405
406## ChildrenMainSize<sup>12+</sup>
407
408Provides the size information of the child components of the **List** or **ListItemGroup** component along the main axis. This object only supports one-to-one binding to the **List** or **ListItemGroup** component.
409
410**Atomic service API**: This API can be used in atomic services since API version 12.
411
412### constructor<sup>12+</sup>
413
414constructor(childDefaultSize: number): void
415
416A constructor used to create a **ChildrenMainSize** object.
417
418**Atomic service API**: This API can be used in atomic services since API version 12.
419
420**System capability**: SystemCapability.ArkUI.ArkUI.Full
421
422**Parameters**
423
424| Name  | Type                           | Mandatory  | Description                  |
425| ---- | ----------------------------- | ---- | -------------------- |
426| childDefaultSize | number | Yes   | Default size of the child component along the main axis.<br>Unit: vp<br>**NOTE**<br>The value must be a finite non-negative number; otherwise, an exception will be thrown.|
427
428
429### childDefaultSize<sup>12+</sup>
430
431set childDefaultSize(value: number): void
432
433Sets the default size of the child component along the main axis.
434
435**Atomic service API**: This API can be used in atomic services since API version 12.
436
437**System capability**: SystemCapability.ArkUI.ArkUI.Full
438
439**Parameters**
440
441| Name  | Type                           | Mandatory  | Description                  |
442| ---- | ----------------------------- | ---- | -------------------- |
443| value | number | Yes   | Default size of the child component along the main axis.<br>Unit: vp<br>**NOTE**<br>The value must be a finite non-negative number; otherwise, an exception will be thrown.|
444
445**Error codes**
446
447For details about the error codes, see [Universal Error Codes](../../errorcode-universal.md).
448
449| ID| Error Message|
450| ------- | -------- |
451| 401      | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3. Parameter verification failed.   |
452
453get childDefaultSize(): number
454
455Obtains the default size of the child component along the main axis.
456
457**Atomic service API**: This API can be used in atomic services since API version 12.
458
459**System capability**: SystemCapability.ArkUI.ArkUI.Full
460
461**Return value**
462
463| Type                                                        | Description                                                        |
464| ------------------------------------------------------------ | ------------------------------------------------------------ |
465| number | Default size of the child component along the main axis.<br>Unit: vp|
466
467### splice<sup>12+</sup>
468
469splice(start: number, deleteCount?: number, childrenSize?: Array\<number>): void
470
471Performs batch operations to add, delete, or modify the size information of child components along the main axis.
472
473**Atomic service API**: This API can be used in atomic services since API version 12.
474
475**System capability**: SystemCapability.ArkUI.ArkUI.Full
476
477**Parameters**
478
479| Name  | Type                           | Mandatory  | Description                  |
480| ---- | ----------------------------- | ---- | -------------------- |
481| start | number | Yes   | Index starting from 0, which indicates the position at which to begin modifying the size information of child components along the main axis.<br>**NOTE**<br>1. The value must be a finite non-negative number; otherwise, an exception will be thrown.<br>2. Non-integer values are truncated to the nearest integer.<br>3. Values exceeding the maximum index do not take effect.|
482| deleteCount | number | No   | Number of size information entries to be deleted starting from the **start** position.<br>**NOTE**<br>1.  The value must be a finite non-negative number; otherwise, it will be treated as **0**.<br>2. Non-integer values are truncated to the nearest integer.<br>3. The result of (start + deleteCount - 1) can exceed the maximum index, which will delete all size information of child components starting from the **start** position.|
483| childrenSize | Array\<number > | No   | Size information of all child components to be inserted, starting from the **start** position.<br>Unit for each value in the array: vp<br>**NOTE**<br>1. If the values in the array are finite non-negative number, they are considered specified sizes and will not change with the default size.<br>2. 2. If the values in the array are not finite non-negative number, they will be treated as the default size and will change with the default size. |
484
485
486**Error codes**
487
488For details about the error codes, see [Universal Error Codes](../../errorcode-universal.md).
489
490| ID| Error Message|
491| ------- | -------- |
492| 401      | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3. Parameter verification failed.   |
493
494
495> **NOTE**
496>
497> - If only the **start** parameter is used, it means to delete the size information of the child components starting from the **start** position and beyond.
498> - If only the **start** and **deleteCount** parameters are used, it means to delete the **deleteCount**-specified number of size information entries starting from the **start** position. This is generally used when you remove child components.
499> - If all three parameters are used, it means to delete the **deleteCount**-specified number of size information entries starting from the **start** position, and then insert all the size information from **childrenSize** at the **start** position. This is generally used when you add child components or batch update the main axis size of child components. If it's only about adding child components, **deleteCount** should be **0**, and the number of elements in **childrenSize** should be equal to the number of child components being added. If it's only about batch updating the main axis size of child components, the number of elements in **childrenSize** should be equal to **deleteCount**, which is the number of updates being made.
500> - If you want to notify that the size of a child component should be the default size, the corresponding value in **childrenSize** should not be given as a finite non-negative value, but rather as **NaN**, any negative value, or any other value that can be processed as the default size.
501
502### update<sup>12+</sup>
503
504update(index: number, childSize: number): void
505
506Updates the main axis size information of the child component corresponding to the specified index.
507
508**Atomic service API**: This API can be used in atomic services since API version 12.
509
510**System capability**: SystemCapability.ArkUI.ArkUI.Full
511
512**Parameters**
513
514| Name  | Type                           | Mandatory  | Description                  |
515| ---- | ----------------------------- | ---- | -------------------- |
516| index | number | Yes   | Index starting from 0, which indicates the position at which to begin modifying the size information of child components along the main axis.<br>**NOTE**<br>1. The value must be a finite non-negative number; otherwise, an exception will be thrown.<br>2. Non-integer values are truncated to the nearest integer.<br>3. Values exceeding the maximum index do not take effect.|
517| childSize | number | Yes   | Size to be updated to.<br>Unit: vp<br>**NOTE**<br>1. If the value is a finite non-negative number, it is considered a specified size and will not change with the default size.<br>2. 2. If the value is not a finite non-negative number, it will be processed as the default size and will change with the default size. |
518
519**Error codes**
520
521For details about the error codes, see [Universal Error Codes](../../errorcode-universal.md).
522
523| ID| Error Message|
524| ------- | -------- |
525| 401      | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3. Parameter verification failed.   |
526