1e41f4b71Sopenharmony_ci# Scrollable Component Common APIs 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ciThe 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. 4e41f4b71Sopenharmony_ci 5e41f4b71Sopenharmony_ci> **NOTE** 6e41f4b71Sopenharmony_ci> 7e41f4b71Sopenharmony_ci> 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. 8e41f4b71Sopenharmony_ci 9e41f4b71Sopenharmony_ci## Attributes 10e41f4b71Sopenharmony_ci 11e41f4b71Sopenharmony_ci### scrollBar<sup>11+</sup> 12e41f4b71Sopenharmony_ci 13e41f4b71Sopenharmony_ciscrollBar(barState: BarState): T 14e41f4b71Sopenharmony_ci 15e41f4b71Sopenharmony_ciSets the scrollbar state. 16e41f4b71Sopenharmony_ci 17e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 18e41f4b71Sopenharmony_ci 19e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 20e41f4b71Sopenharmony_ci 21e41f4b71Sopenharmony_ci**Parameters** 22e41f4b71Sopenharmony_ci 23e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 24e41f4b71Sopenharmony_ci| -------- | ----------------------------------------- | ---- | -------------------------------------- | 25e41f4b71Sopenharmony_ci| 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| 26e41f4b71Sopenharmony_ci 27e41f4b71Sopenharmony_ci### scrollBarColor<sup>11+</sup> 28e41f4b71Sopenharmony_ci 29e41f4b71Sopenharmony_ciscrollBarColor(color: Color | number | string): T 30e41f4b71Sopenharmony_ci 31e41f4b71Sopenharmony_ciSets the scrollbar color. 32e41f4b71Sopenharmony_ci 33e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 34e41f4b71Sopenharmony_ci 35e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 36e41f4b71Sopenharmony_ci 37e41f4b71Sopenharmony_ci**Parameters** 38e41f4b71Sopenharmony_ci 39e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 40e41f4b71Sopenharmony_ci| ------ | ------------------------------------------------------------ | ---- | -------------- | 41e41f4b71Sopenharmony_ci| color | string \| number \| [Color](ts-appendix-enums.md#color) | Yes | Scrollbar color.<br>Default value: **'\#182431'** (40% opacity)| 42e41f4b71Sopenharmony_ci 43e41f4b71Sopenharmony_ci### scrollBarWidth<sup>11+</sup> 44e41f4b71Sopenharmony_ci 45e41f4b71Sopenharmony_ciscrollBarWidth(value: number | string): T 46e41f4b71Sopenharmony_ci 47e41f4b71Sopenharmony_ciSets 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. 48e41f4b71Sopenharmony_ci 49e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 50e41f4b71Sopenharmony_ci 51e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 52e41f4b71Sopenharmony_ci 53e41f4b71Sopenharmony_ci**Parameters** 54e41f4b71Sopenharmony_ci 55e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 56e41f4b71Sopenharmony_ci| ------ | -------------------------- | ---- | ----------------------------------------- | 57e41f4b71Sopenharmony_ci| value | string \| number | Yes | Scrollbar width.<br>Default value: **4**<br>Unit: vp| 58e41f4b71Sopenharmony_ci 59e41f4b71Sopenharmony_ci### edgeEffect<sup>11+</sup> 60e41f4b71Sopenharmony_ci 61e41f4b71Sopenharmony_ciedgeEffect(edgeEffect: EdgeEffect, options?: EdgeEffectOptions): T 62e41f4b71Sopenharmony_ci 63e41f4b71Sopenharmony_ciSets the effect used when the scroll boundary is reached. 64e41f4b71Sopenharmony_ci 65e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 66e41f4b71Sopenharmony_ci 67e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 68e41f4b71Sopenharmony_ci 69e41f4b71Sopenharmony_ci**Parameters** 70e41f4b71Sopenharmony_ci 71e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 72e41f4b71Sopenharmony_ci| --------------------- | ------------------------------------------------- | ---- | ------------------------------------------------------------ | 73e41f4b71Sopenharmony_ci| 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| 74e41f4b71Sopenharmony_ci| 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| 75e41f4b71Sopenharmony_ci 76e41f4b71Sopenharmony_ci### nestedScroll<sup>11+</sup> 77e41f4b71Sopenharmony_ci 78e41f4b71Sopenharmony_cinestedScroll(value: NestedScrollOptions): T 79e41f4b71Sopenharmony_ci 80e41f4b71Sopenharmony_ciSets 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. 81e41f4b71Sopenharmony_ci 82e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 83e41f4b71Sopenharmony_ci 84e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 85e41f4b71Sopenharmony_ci 86e41f4b71Sopenharmony_ci**Parameters** 87e41f4b71Sopenharmony_ci 88e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 89e41f4b71Sopenharmony_ci| ------ | ----------------------------------------------------- | ---- | -------------- | 90e41f4b71Sopenharmony_ci| value | [NestedScrollOptions](#nestedscrolloptions10) | Yes | Nested scrolling options.| 91e41f4b71Sopenharmony_ci 92e41f4b71Sopenharmony_ci### enableScrollInteraction<sup>11+</sup> 93e41f4b71Sopenharmony_ci 94e41f4b71Sopenharmony_cienableScrollInteraction(value: boolean): T 95e41f4b71Sopenharmony_ci 96e41f4b71Sopenharmony_ciSets 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. 97e41f4b71Sopenharmony_ci 98e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 99e41f4b71Sopenharmony_ci 100e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 101e41f4b71Sopenharmony_ci 102e41f4b71Sopenharmony_ci**Parameters** 103e41f4b71Sopenharmony_ci 104e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 105e41f4b71Sopenharmony_ci| ------ | ------- | ---- | ----------------------------------- | 106e41f4b71Sopenharmony_ci| value | boolean | Yes | Whether to support scroll gestures.<br>Default value: **true**| 107e41f4b71Sopenharmony_ci 108e41f4b71Sopenharmony_ci### friction<sup>11+</sup> 109e41f4b71Sopenharmony_ci 110e41f4b71Sopenharmony_cifriction(value: number | Resource): T 111e41f4b71Sopenharmony_ci 112e41f4b71Sopenharmony_ciSets 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. 113e41f4b71Sopenharmony_ci 114e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 115e41f4b71Sopenharmony_ci 116e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 117e41f4b71Sopenharmony_ci 118e41f4b71Sopenharmony_ci**Parameters** 119e41f4b71Sopenharmony_ci 120e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 121e41f4b71Sopenharmony_ci| ------ | ---------------------------------------------------- | ---- | --------------------------------------------------------- | 122e41f4b71Sopenharmony_ci| 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**.| 123e41f4b71Sopenharmony_ci 124e41f4b71Sopenharmony_ci### flingSpeedLimit<sup>11+</sup> 125e41f4b71Sopenharmony_ci 126e41f4b71Sopenharmony_ciflingSpeedLimit(speedLimit: number): T 127e41f4b71Sopenharmony_ci 128e41f4b71Sopenharmony_ciSets the maximum starting fling speed when the fling animation starts. If this attribute is set to a value less than or equal to 0, the default value is used. 129e41f4b71Sopenharmony_ci 130e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 131e41f4b71Sopenharmony_ci 132e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 133e41f4b71Sopenharmony_ci 134e41f4b71Sopenharmony_ci**Parameters** 135e41f4b71Sopenharmony_ci 136e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 137e41f4b71Sopenharmony_ci| ---------- | ------ | ---- | ------------------------------- | 138e41f4b71Sopenharmony_ci| speedLimit | number | Yes | Maximum starting fling speed when the fling animation starts.<br>Default value: **12000**<br>Unit: vp/s| 139e41f4b71Sopenharmony_ci 140e41f4b71Sopenharmony_ci 141e41f4b71Sopenharmony_ci## Events 142e41f4b71Sopenharmony_ci 143e41f4b71Sopenharmony_ci### onReachStart<sup>11+</sup> 144e41f4b71Sopenharmony_ci 145e41f4b71Sopenharmony_cionReachStart(event: () => void): T 146e41f4b71Sopenharmony_ci 147e41f4b71Sopenharmony_ciTriggered when the scrollable component reaches the start position. 148e41f4b71Sopenharmony_ci 149e41f4b71Sopenharmony_ciThis 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. 150e41f4b71Sopenharmony_ci 151e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 152e41f4b71Sopenharmony_ci 153e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 154e41f4b71Sopenharmony_ci 155e41f4b71Sopenharmony_ci### onReachEnd<sup>11+</sup> 156e41f4b71Sopenharmony_ci 157e41f4b71Sopenharmony_cionReachEnd(event: () => void): T 158e41f4b71Sopenharmony_ci 159e41f4b71Sopenharmony_ciTriggered when the scrollable component reaches the end position. 160e41f4b71Sopenharmony_ci 161e41f4b71Sopenharmony_ciIf 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. 162e41f4b71Sopenharmony_ci 163e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 164e41f4b71Sopenharmony_ci 165e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 166e41f4b71Sopenharmony_ci 167e41f4b71Sopenharmony_ci### onScrollStart<sup>11+</sup> 168e41f4b71Sopenharmony_ci 169e41f4b71Sopenharmony_cionScrollStart(event: () => void): T 170e41f4b71Sopenharmony_ci 171e41f4b71Sopenharmony_ciTriggered 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. 172e41f4b71Sopenharmony_ci 173e41f4b71Sopenharmony_ci**NOTE** 174e41f4b71Sopenharmony_ci 175e41f4b71Sopenharmony_ci1. 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. 176e41f4b71Sopenharmony_ci 177e41f4b71Sopenharmony_ci2. This event is triggered when the controller API is called, accompanied by a transition animation. 178e41f4b71Sopenharmony_ci 179e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 180e41f4b71Sopenharmony_ci 181e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 182e41f4b71Sopenharmony_ci 183e41f4b71Sopenharmony_ci### onScrollStop<sup>11+</sup> 184e41f4b71Sopenharmony_ci 185e41f4b71Sopenharmony_cionScrollStop(event: () => void): T 186e41f4b71Sopenharmony_ci 187e41f4b71Sopenharmony_ciTriggered 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. 188e41f4b71Sopenharmony_ci 189e41f4b71Sopenharmony_ci**NOTE** 190e41f4b71Sopenharmony_ci 191e41f4b71Sopenharmony_ci1. 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. 192e41f4b71Sopenharmony_ci 193e41f4b71Sopenharmony_ci2. This event is triggered when the controller API is called, accompanied by a transition animation. 194e41f4b71Sopenharmony_ci 195e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 196e41f4b71Sopenharmony_ci 197e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 198e41f4b71Sopenharmony_ci 199e41f4b71Sopenharmony_ci### onWillScroll<sup>12+</sup> 200e41f4b71Sopenharmony_ci 201e41f4b71Sopenharmony_cionWillScroll(handler: Optional<OnWillScrollCallback>): T 202e41f4b71Sopenharmony_ci 203e41f4b71Sopenharmony_ciTriggered when the scrollable component is about to scroll. 204e41f4b71Sopenharmony_ci 205e41f4b71Sopenharmony_ciThe 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. 206e41f4b71Sopenharmony_ci 207e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12. 208e41f4b71Sopenharmony_ci 209e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 210e41f4b71Sopenharmony_ci 211e41f4b71Sopenharmony_ci**Parameters** 212e41f4b71Sopenharmony_ci 213e41f4b71Sopenharmony_ci| Name| Type| Mandatory| Description| 214e41f4b71Sopenharmony_ci| ------ | ------ | ------ | ------| 215e41f4b71Sopenharmony_ci| handler | Optional<[OnWillScrollCallback](#onwillscrollcallback12)> | Yes| Callback triggered when the scrollable component is about to scroll.| 216e41f4b71Sopenharmony_ci 217e41f4b71Sopenharmony_ci> **NOTE** 218e41f4b71Sopenharmony_ci> 219e41f4b71Sopenharmony_ci> When **ScrollEdge** and **ScrollToIndex** that does not involve animation is called, **onWillScroll** is not invoked. 220e41f4b71Sopenharmony_ci 221e41f4b71Sopenharmony_ci 222e41f4b71Sopenharmony_ci### onDidScroll<sup>12+</sup> 223e41f4b71Sopenharmony_ci 224e41f4b71Sopenharmony_cionDidScroll(handler: OnScrollCallback): T 225e41f4b71Sopenharmony_ci 226e41f4b71Sopenharmony_ciTriggered when the scrollable component scrolls. The return value is the offset amount by which the list has scrolled and the current scroll state. 227e41f4b71Sopenharmony_ci 228e41f4b71Sopenharmony_ci**Widget capability**: This API can be used in ArkTS widgets since API version 12. 229e41f4b71Sopenharmony_ci 230e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12. 231e41f4b71Sopenharmony_ci 232e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 233e41f4b71Sopenharmony_ci 234e41f4b71Sopenharmony_ci**Parameters** 235e41f4b71Sopenharmony_ci 236e41f4b71Sopenharmony_ci| Name| Type| Mandatory| Description| 237e41f4b71Sopenharmony_ci| ------ | ------ | ------ | ------| 238e41f4b71Sopenharmony_ci| handler | [OnScrollCallback](#onscrollcallback12) | Yes| Callback triggered when the scrollable component scrolls.| 239e41f4b71Sopenharmony_ci 240e41f4b71Sopenharmony_ci### onScroll<sup>(deprecated)</sup> 241e41f4b71Sopenharmony_ci 242e41f4b71Sopenharmony_cionScroll(event: (scrollOffset: number, scrollState: ScrollState) => void): T 243e41f4b71Sopenharmony_ci 244e41f4b71Sopenharmony_ciTriggered when the scrollable component scrolls. 245e41f4b71Sopenharmony_ci 246e41f4b71Sopenharmony_ciThis API is supported since API version 11. 247e41f4b71Sopenharmony_ci 248e41f4b71Sopenharmony_ciThis API is deprecated since API version 12. You are advised to use [onDidScroll](#ondidscroll12) instead. 249e41f4b71Sopenharmony_ci 250e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 251e41f4b71Sopenharmony_ci 252e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 253e41f4b71Sopenharmony_ci 254e41f4b71Sopenharmony_ci**Parameters** 255e41f4b71Sopenharmony_ci 256e41f4b71Sopenharmony_ci| Name| Type| Mandatory| Description| 257e41f4b71Sopenharmony_ci| ------ | ------ | ------ | ------| 258e41f4b71Sopenharmony_ci| 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| 259e41f4b71Sopenharmony_ci| scrollState | [ScrollState](ts-container-list.md#scrollstate)| Yes| Current scroll state.| 260e41f4b71Sopenharmony_ci 261e41f4b71Sopenharmony_ci## ItemDragInfo 262e41f4b71Sopenharmony_ci 263e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 264e41f4b71Sopenharmony_ci 265e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 266e41f4b71Sopenharmony_ci 267e41f4b71Sopenharmony_ci| Name | Type | Description | 268e41f4b71Sopenharmony_ci| ---------- | ---------- | ---------- | 269e41f4b71Sopenharmony_ci| x | number | X coordinate of the dragged item, in vp. | 270e41f4b71Sopenharmony_ci| y | number | Y coordinate of the dragged item, in vp. | 271e41f4b71Sopenharmony_ci 272e41f4b71Sopenharmony_ci## NestedScrollOptions<sup>10+</sup> 273e41f4b71Sopenharmony_ci 274e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 275e41f4b71Sopenharmony_ci 276e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 277e41f4b71Sopenharmony_ci 278e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 279e41f4b71Sopenharmony_ci| ----- | ------ | ------ | ----------------- | 280e41f4b71Sopenharmony_ci| scrollForward | [NestedScrollMode](ts-appendix-enums.md#nestedscrollmode10) | Yes| Nested scrolling options when the scrollable component scrolls forward.| 281e41f4b71Sopenharmony_ci| scrollBackward | [NestedScrollMode](ts-appendix-enums.md#nestedscrollmode10) | Yes| Nested scrolling options when the scrollable component scrolls backward.| 282e41f4b71Sopenharmony_ci 283e41f4b71Sopenharmony_ci## EdgeEffectOptions<sup>11+</sup> 284e41f4b71Sopenharmony_ci 285e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12. 286e41f4b71Sopenharmony_ci 287e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 288e41f4b71Sopenharmony_ci 289e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 290e41f4b71Sopenharmony_ci| ----- | ------| ------- | ----------------- | 291e41f4b71Sopenharmony_ci| alwaysEnabled | boolean | Yes| Whether to enable the scroll effect when the component content is smaller than the component itself.| 292e41f4b71Sopenharmony_ci 293e41f4b71Sopenharmony_ci## OnWillScrollCallback<sup>12+</sup> 294e41f4b71Sopenharmony_ci 295e41f4b71Sopenharmony_citype OnWillScrollCallback = (scrollOffset: number, scrollState: ScrollState, scrollSource: ScrollSource) => void | ScrollResult 296e41f4b71Sopenharmony_ci 297e41f4b71Sopenharmony_ciCallback triggered when the scrollable component is about to scroll. 298e41f4b71Sopenharmony_ci 299e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12. 300e41f4b71Sopenharmony_ci 301e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 302e41f4b71Sopenharmony_ci 303e41f4b71Sopenharmony_ci**Parameters** 304e41f4b71Sopenharmony_ci 305e41f4b71Sopenharmony_ci| Name| Type| Mandatory| Description| 306e41f4b71Sopenharmony_ci| ------ | ------ | ------ | ------| 307e41f4b71Sopenharmony_ci| 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| 308e41f4b71Sopenharmony_ci| scrollState | [ScrollState](ts-container-list.md#scrollstate)| Yes| Current scroll state.| 309e41f4b71Sopenharmony_ci| scrollSource | [ScrollSource](ts-appendix-enums.md#scrollsource12) | Yes| Source of the current scrolling operation.| 310e41f4b71Sopenharmony_ci 311e41f4b71Sopenharmony_ci**Return value** 312e41f4b71Sopenharmony_ci 313e41f4b71Sopenharmony_ci| Type | Description | 314e41f4b71Sopenharmony_ci| ----------------------------- | ------------------------------------ | 315e41f4b71Sopenharmony_ci| 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.| 316e41f4b71Sopenharmony_ci 317e41f4b71Sopenharmony_ci## OnScrollCallback<sup>12+</sup> 318e41f4b71Sopenharmony_ci 319e41f4b71Sopenharmony_citype OnScrollCallback = (scrollOffset: number, scrollState: ScrollState) => void 320e41f4b71Sopenharmony_ci 321e41f4b71Sopenharmony_ciCallback triggered when the scrollable component scrolls. 322e41f4b71Sopenharmony_ci 323e41f4b71Sopenharmony_ci**Widget capability**: This API can be used in ArkTS widgets since API version 12. 324e41f4b71Sopenharmony_ci 325e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12. 326e41f4b71Sopenharmony_ci 327e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 328e41f4b71Sopenharmony_ci 329e41f4b71Sopenharmony_ci| Name| Type| Mandatory| Description| 330e41f4b71Sopenharmony_ci| ------ | ------ | ------ | ------| 331e41f4b71Sopenharmony_ci| 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| 332e41f4b71Sopenharmony_ci| scrollState | [ScrollState](ts-container-list.md#scrollstate)| Yes| Current scroll state.| 333e41f4b71Sopenharmony_ci 334e41f4b71Sopenharmony_ci## ScrollResult<sup>12+</sup> 335e41f4b71Sopenharmony_ci 336e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12. 337e41f4b71Sopenharmony_ci 338e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 339e41f4b71Sopenharmony_ci 340e41f4b71Sopenharmony_ci| Name| Type| Mandatory| Description| 341e41f4b71Sopenharmony_ci| ------ | ------ | ------ | ------| 342e41f4b71Sopenharmony_ci| offsetRemain | number | Yes| Amount by which the component is about to be scrolled, in vp.| 343e41f4b71Sopenharmony_ci 344e41f4b71Sopenharmony_ci## ChildrenMainSize<sup>12+</sup> 345e41f4b71Sopenharmony_ci 346e41f4b71Sopenharmony_ciProvides 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. 347e41f4b71Sopenharmony_ci 348e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12. 349e41f4b71Sopenharmony_ci 350e41f4b71Sopenharmony_ci### constructor<sup>12+</sup> 351e41f4b71Sopenharmony_ci 352e41f4b71Sopenharmony_ciconstructor(childDefaultSize: number): void 353e41f4b71Sopenharmony_ci 354e41f4b71Sopenharmony_ciA constructor used to create a **ChildrenMainSize** object. 355e41f4b71Sopenharmony_ci 356e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12. 357e41f4b71Sopenharmony_ci 358e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 359e41f4b71Sopenharmony_ci 360e41f4b71Sopenharmony_ci**Parameters** 361e41f4b71Sopenharmony_ci 362e41f4b71Sopenharmony_ci| Name | Type | Mandatory | Description | 363e41f4b71Sopenharmony_ci| ---- | ----------------------------- | ---- | -------------------- | 364e41f4b71Sopenharmony_ci| 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.| 365e41f4b71Sopenharmony_ci 366e41f4b71Sopenharmony_ci 367e41f4b71Sopenharmony_ci### childDefaultSize<sup>12+</sup> 368e41f4b71Sopenharmony_ci 369e41f4b71Sopenharmony_ciset childDefaultSize(value: number): void 370e41f4b71Sopenharmony_ci 371e41f4b71Sopenharmony_ciSets the default size of the child component along the main axis. 372e41f4b71Sopenharmony_ci 373e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12. 374e41f4b71Sopenharmony_ci 375e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 376e41f4b71Sopenharmony_ci 377e41f4b71Sopenharmony_ci**Parameters** 378e41f4b71Sopenharmony_ci 379e41f4b71Sopenharmony_ci| Name | Type | Mandatory | Description | 380e41f4b71Sopenharmony_ci| ---- | ----------------------------- | ---- | -------------------- | 381e41f4b71Sopenharmony_ci| 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.| 382e41f4b71Sopenharmony_ci 383e41f4b71Sopenharmony_ci**Error codes** 384e41f4b71Sopenharmony_ci 385e41f4b71Sopenharmony_ciFor details about the error codes, see [Universal Error Codes](../../errorcode-universal.md). 386e41f4b71Sopenharmony_ci 387e41f4b71Sopenharmony_ci| ID| Error Message| 388e41f4b71Sopenharmony_ci| ------- | -------- | 389e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3. Parameter verification failed. | 390e41f4b71Sopenharmony_ci 391e41f4b71Sopenharmony_ciget childDefaultSize(): number 392e41f4b71Sopenharmony_ci 393e41f4b71Sopenharmony_ciObtains the default size of the child component along the main axis. 394e41f4b71Sopenharmony_ci 395e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12. 396e41f4b71Sopenharmony_ci 397e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 398e41f4b71Sopenharmony_ci 399e41f4b71Sopenharmony_ci**Return value** 400e41f4b71Sopenharmony_ci 401e41f4b71Sopenharmony_ci| Type | Description | 402e41f4b71Sopenharmony_ci| ------------------------------------------------------------ | ------------------------------------------------------------ | 403e41f4b71Sopenharmony_ci| number | Default size of the child component along the main axis.<br>Unit: vp| 404e41f4b71Sopenharmony_ci 405e41f4b71Sopenharmony_ci### splice<sup>12+</sup> 406e41f4b71Sopenharmony_ci 407e41f4b71Sopenharmony_cisplice(start: number, deleteCount?: number, childrenSize?: Array\<number>): void 408e41f4b71Sopenharmony_ci 409e41f4b71Sopenharmony_ciPerforms batch operations to add, delete, or modify the size information of child components along the main axis. 410e41f4b71Sopenharmony_ci 411e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12. 412e41f4b71Sopenharmony_ci 413e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 414e41f4b71Sopenharmony_ci 415e41f4b71Sopenharmony_ci**Parameters** 416e41f4b71Sopenharmony_ci 417e41f4b71Sopenharmony_ci| Name | Type | Mandatory | Description | 418e41f4b71Sopenharmony_ci| ---- | ----------------------------- | ---- | -------------------- | 419e41f4b71Sopenharmony_ci| 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.| 420e41f4b71Sopenharmony_ci| 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.| 421e41f4b71Sopenharmony_ci| 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. | 422e41f4b71Sopenharmony_ci 423e41f4b71Sopenharmony_ci 424e41f4b71Sopenharmony_ci**Error codes** 425e41f4b71Sopenharmony_ci 426e41f4b71Sopenharmony_ciFor details about the error codes, see [Universal Error Codes](../../errorcode-universal.md). 427e41f4b71Sopenharmony_ci 428e41f4b71Sopenharmony_ci| ID| Error Message| 429e41f4b71Sopenharmony_ci| ------- | -------- | 430e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3. Parameter verification failed. | 431e41f4b71Sopenharmony_ci 432e41f4b71Sopenharmony_ci 433e41f4b71Sopenharmony_ci> **NOTE** 434e41f4b71Sopenharmony_ci> 435e41f4b71Sopenharmony_ci> - 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. 436e41f4b71Sopenharmony_ci> - 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. 437e41f4b71Sopenharmony_ci> - 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. 438e41f4b71Sopenharmony_ci> - 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. 439e41f4b71Sopenharmony_ci 440e41f4b71Sopenharmony_ci### update<sup>12+</sup> 441e41f4b71Sopenharmony_ci 442e41f4b71Sopenharmony_ciupdate(index: number, childSize: number): void 443e41f4b71Sopenharmony_ci 444e41f4b71Sopenharmony_ciUpdates the main axis size information of the child component corresponding to the specified index. 445e41f4b71Sopenharmony_ci 446e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12. 447e41f4b71Sopenharmony_ci 448e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 449e41f4b71Sopenharmony_ci 450e41f4b71Sopenharmony_ci**Parameters** 451e41f4b71Sopenharmony_ci 452e41f4b71Sopenharmony_ci| Name | Type | Mandatory | Description | 453e41f4b71Sopenharmony_ci| ---- | ----------------------------- | ---- | -------------------- | 454e41f4b71Sopenharmony_ci| 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.| 455e41f4b71Sopenharmony_ci| 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. | 456e41f4b71Sopenharmony_ci 457e41f4b71Sopenharmony_ci**Error codes** 458e41f4b71Sopenharmony_ci 459e41f4b71Sopenharmony_ciFor details about the error codes, see [Universal Error Codes](../../errorcode-universal.md). 460e41f4b71Sopenharmony_ci 461e41f4b71Sopenharmony_ci| ID| Error Message| 462e41f4b71Sopenharmony_ci| ------- | -------- | 463e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3. Parameter verification failed. | 464