1# Swiper 2 3 The **\<Swiper>** component is able to display child components in looping mode. 4 5> **NOTE** 6> 7> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. 8 9 10## Child Components 11 12This component can contain child components. 13 14> **NOTE** 15> 16> Built-in components and custom components are allowed, with support for ([if/else](../../quick-start/arkts-rendering-control-ifelse.md), [ForEach](../../quick-start/arkts-rendering-control-foreach.md), and [LazyForEach](../../quick-start/arkts-rendering-control-lazyforeach.md)) rendering control. 17> 18> When the **\<Swiper>** component's **displayMode** attribute is set to **SwiperDisplayMode.AutoLinear** or its **displayCount** attribute is set to **'auto'**, the child component whose **visibility** attribute is set to **None** does not take up space in the viewport, but this does not affect the number of navigation dots. 19> 20> If the **visibility** attribute of a child component is set to **None** or **Hidden**, it takes up space in the viewport, but is not displayed. 21> 22> When the number of child components is less than or equal to the total number of allowed nodes (totalDisplayCount = DisplayCount + prevMargin? (1: 0 ) + nextMargin? (1: 0 )) in the content area, the **\<Swiper>** component uses the non-looping mode for layout. In this case, the child components specified by **nextMargin** and **prevMargin** take up space in the viewport, but are not displayed. The specifications of the **\<Swiper>** component are calculated based on the value of **totalDisplayCount**. 23 24 25## APIs 26 27Swiper(controller?: SwiperController) 28 29**Parameters** 30 31| Name | Type | Mandatory | Description | 32| ---------- | ------------------------------------- | ---- | -------------------- | 33| controller | [SwiperController](#swipercontroller) | No | Controller bound to the component to control the page switching.| 34 35 36## Attributes 37 38In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported. [Menu control](ts-universal-attributes-menu.md) is not supported. 39 40| Name | Type | Description | 41| ------------------------------------- | ---------------------------------------- | ---------------------------------------- | 42| index | number | Index of the child component currently displayed in the container.<br>Default value: **0**<br>**NOTE**<br>If the value is less than 0 or greater than or equal to the number of child components, the default value **0** is used.<br>Since API version 10, this attribute supports [$$](../../quick-start/arkts-two-way-sync.md) for two-way binding of variables.| 43| autoPlay | boolean | Whether to enable automatic playback for child component switching.<br>Default value: **false**<br>**NOTE**<br>If **loop** is set to **false**, the playback stops when the last page is displayed. The playback continues when the page is not the last page after a swipe gesture.| 44| interval | number | Interval for automatic playback, in ms.<br>Default value: **3000** | 45| indicator<sup>10+</sup> | [DotIndicator](#dotindicator10) \| [DigitIndicator](#digitindicator10) \| boolean | Style of the navigation point indicator.<br> \- **DotIndicator**: dot style.<br> \- **DigitIndicator**: digit style.<br> \- **boolean**: whether to enable the navigation point indicator.<br> Default value: **true**<br> Default type: **DotIndicator**| 46| loop | boolean | Whether to enable loop playback.<br>The value **true** means to enable loop playback. When LazyForEach is used, it is recommended that the number of the components to load exceed 5.<br>Default value: **true**| 47| duration | number | Duration of the animation for switching child components, in ms.<br>Default value: **400** | 48| vertical | boolean | Whether vertical swiping is used.<br>Default value: **false** | 49| itemSpace | number \| string | Space between child components.<br>Default value: **0**<br>**NOTE**<br>This parameter cannot be set in percentage.| 50| displayMode | SwiperDisplayMode | Mode in which elements are displayed along the main axis. This attribute takes effect only when **displayCount** is not set.<br>Default value: **SwiperDisplayMode.Stretch**| 51| cachedCount<sup>8+</sup> | number | Number of child components to be cached.<br>Default value: **1**| 52| disableSwipe<sup>8+</sup> | boolean | Whether to disable the swipe feature.<br>Default value: **false** | 53| curve<sup>8+</sup> | [Curve](ts-appendix-enums.md#curve) \| string | Animation curve. The ease-in/ease-out curve is used by default. For details about common curves, see [Curve](ts-appendix-enums.md#curve). You can also create custom curves (interpolation curve objects) by using the API provided by the [interpolation calculation](../apis/js-apis-curve.md) module.<br>Default value: **Curve.Linear**| 54| indicatorStyle<sup>(deprecated)</sup> | {<br>left?: [Length](ts-types.md#length),<br>top?: [Length](ts-types.md#length),<br>right?: [Length](ts-types.md#length),<br>bottom?: [Length](ts-types.md#length),<br>size?: [Length](ts-types.md#length),<br>mask?: boolean,<br>color?: [ResourceColor](ts-types.md),<br>selectedColor?: [ResourceColor](ts-types.md)<br>} | Style of the navigation point indicator.<br>\- **left**: distance between the navigation point indicator and the left edge of the **\<Swiper>** component.<br>\- **top**: distance between the navigation point indicator and the top edge of the **\<Swiper>** component.<br>\- **right**: distance between the navigation point indicator and the right edge of the **\<Swiper>** component.<br>\- **bottom**: distance between the navigation point indicator and the bottom edge of the **\<Swiper>** component.<br>\- **size**: diameter of the navigation point indicator. The value cannot be in percentage. Default value: **6vp**<br>\- **mask**: whether to enable the mask for the navigation point indicator.<br>\- **color**: color of the navigation point indicator.<br>\- **selectedColor**: color of the selected navigation dot.<br>This API is supported since API version 8 and is deprecated since API version 10. You are advised to use [indicator](#indicator10) instead.| 55| displayCount<sup>8+</sup> | number \| string \| <br>[SwiperAutoFill](#swiperautofill10)<sup>10+</sup> | Number of elements to display per page.<br>Default value: **1**<br>**NOTE**<br>If the value is of the string type, it can only be **'auto'**, whose display effect is the same as that of **SwiperDisplayMode.AutoLinear**.<br>If the value is set to a number less than or equal to 0, the default value **1** is used.<br>If the value is of the number type, child components stretch (shrink) on the main axis after the swiper width [deducting the result of itemSpace x (displayCount - 1)] is evenly distributed among them on the main axis.<br> If the value is of the SwiperAutoFill type, the system automatically calculates and changes the number of elements to display per page based on the **\<Swiper>** component width and the **minSize** settings for the child component. If **minSize** is left empty or set to a value less than or equal to 0, the **\<Swiper>** component displays one column.| 56| effectMode<sup>8+</sup> | [EdgeEffect](ts-appendix-enums.md#edgeeffect) | Swipe effect. For details, see **EdgeEffect**.<br>Default value: **EdgeEffect.Spring**<br>**NOTE**<br>The spring effect does not take effect when the controller API is called.| 57| displayArrow<sup>10+</sup> | value:[ArrowStyle](#arrowstyle10) \| boolean,<br>isHoverShow?: boolean | Arrow style of the navigation point indicator.<br>- **value**: arrow and background to set. In abnormal scenarios, the default values in the **ArrowStyle** object are used.<br>\- **isHoverShow**: whether to show the arrow only when the mouse pointer hovers over the navigation point indicator.<br>Default value: **false**<br>**NOTE**<br>When **isHoverShow** is set to **false**, the arrow is always displayed and can be clicked to turn pages.<br>When **isHoverShow** is set to **true**, the arrow is displayed only when the mouse pointer hovers over the navigation point indicator, and it can be clicked to turn pages.| 58| nextMargin<sup>10+</sup> | <br>[Length](ts-types.md#length)<br>| Next margin, used to reveal a small part of the next item.<br>Default value: **0**<br>**NOTE**<br>This attribute is available only when **SwiperDisplayMode** is set to **STRETCH**.<br>When the main axis runs horizontally and either the next margin or previous margin is greater than the calculated width of the child component, neither the next margin nor previous margin is displayed.<br>When the main axis runs vertically and either the next margin or previous margin is greater than the calculated height of the child component, neither the next margin nor previous margin is displayed.| 59| prevMargin<sup>10+</sup> | <br>[Length](ts-types.md#length)<br>| Previous margin, used to reveal a small part of the previous item.<br>Default value: **0**<br>**NOTE**<br>This attribute is available only when **SwiperDisplayMode** is set to **STRETCH**.<br>When the main axis runs horizontally and either the next margin or previous margin is greater than the calculated width of the child component, neither the next margin nor previous margin is displayed.<br>When the main axis runs vertically and either the next margin or previous margin is greater than the calculated height of the child component, neither the next margin nor previous margin is displayed.| 60 61## SwiperDisplayMode 62 63| Name | Description | 64| --------------------------------- | ---------------------------------------- | 65| Stretch<sup>(deprecated)</sup> | The slide width of the **\<Swiper>** component is equal to the width of the component.<br>This API is deprecated since API version 10. You are advised to use **STRETCH** instead.| 66| AutoLinear<sup>(deprecated)</sup> | The slide width of the **\<Swiper>** component is equal to that of the child component with the maximum width.<br>This API is deprecated since API version 10. You are advised to use **AUTO_LINEAR** instead.| 67| STRETCH<sup>10+</sup> | The slide width of the **\<Swiper>** component is equal to the width of the component. | 68| AUTO_LINEAR<sup>10+</sup> | The slide width of the **\<Swiper>** component is equal to the width of the leftmost child component in the viewport. | 69 70## SwiperController 71 72Controller of the **\<Swiper>** component. You can bind this object to the **\<Swiper>** component and use it to control page switching. 73 74### showNext 75 76showNext(): void 77 78Turns to the next page. Page turning occurs with the animation, whose duration is specified by **duration**. 79 80### showPrevious 81 82showPrevious(): void 83 84Turns to the previous page. Page turning occurs with the animation, whose duration is specified by **duration**. 85 86### finishAnimation 87 88finishAnimation(callback?: () => void): void 89 90Stops an animation. 91 92**Parameters** 93 94| Name | Type | Mandatory. | Description | 95| -------- | ---------- | ---- | -------- | 96| callback | () => void | No | Callback invoked when the animation stops.| 97 98## Indicator<sup>10+</sup> 99 100Sets the distance between the navigation point indicator and the **\<Swiper>** component. 101 102| Name | Type | Mandatory. | Description | 103| ------ | ---------------------------- | ---- | ---------------------------------------- | 104| left | [Length](ts-types.md#length) | No | Distance between the navigation point indicator and the left edge of the **\<Swiper>** component.<br>Default value: **0**<br>Unit: vp| 105| top | [Length](ts-types.md#length) | No | Distance between the navigation point indicator and the top edge of the **\<Swiper>** component.<br>Default value: **0**<br>Unit: vp| 106| right | [Length](ts-types.md#length) | No | Distance between the navigation point indicator and the right edge of the **\<Swiper>** component.<br>Default value: **0**<br>Unit: vp| 107| bottom | [Length](ts-types.md#length) | No | Distance between the navigation point indicator and the bottom edge of the **\<Swiper>** component.<br>Default value: **0**<br>Unit: vp| 108 109## DotIndicator<sup>10+</sup> 110 111Defines the navigation point indicator of the dot style, which inherits attributes and features from **Indicator**. 112 113| Name | Type | Mandatory. | Description | 114| ------------------ | ---------------------------------------- | ---- | ---------------------------------------- | 115| itemWidth | [Length](ts-types.md#length) | No | Width of the navigation point indicator of the dot style. This parameter cannot be set in percentage.<br>Default value: **6**<br>Unit: vp| 116| itemHeight | [Length](ts-types.md#length) | No | Height of the navigation point indicator of the dot style. This parameter cannot be set in percentage.<br>Default value: **6**<br>Unit: vp| 117| selectedItemWidth | [Length](ts-types.md#length) | No | Width of the selected navigation point indicator of the dot style. This parameter cannot be set in percentage.<br>Default value: **12**<br>Unit: vp| 118| selectedItemHeight | [Length](ts-types.md#length) | No | Height of the selected navigation point indicator of the dot style. This parameter cannot be set in percentage.<br>Default value: **6**<br>Unit: vp| 119| mask | boolean | No | Whether to enable the mask for the navigation point indicator of the dot style.<br>Default value: **false**| 120| color | [ResourceColor](ts-types.md#resourcecolor) | No | Color of the navigation point indicator of the dot style.<br>Default value: **'\#182431'** (10% opacity)| 121| selectedColor | [ResourceColor](ts-types.md#resourcecolor) | No | Color of the selected indicator dot.<br>Default value: **'\#007DFF'**| 122 123## DigitIndicator<sup>10+</sup> 124 125Defines the navigation point indicator of the digit style, which inherits attributes and features from **Indicator**. 126 127| Name | Type | Mandatory. | Description | 128| ----------------- | ---------------------------------------- | ---- | ---------------------------------------- | 129| fontColor | [ResourceColor](ts-types.md#resourcecolor) | No | Font color of the navigation point indicator of the digit style.<br>Default value: **'\#ff182431'**| 130| selectedFontColor | [ResourceColor](ts-types.md#resourcecolor) | No | Font color of the selected navigation point indicator of the digit style.<br>Default value: **'\#ff182431'**| 131| digitFont | {<br>size?:[Length](ts-types.md#length)<br>weight?:number \| [FontWeight](ts-appendix-enums.md#fontweight) \| string<br>} | No | Font style of the navigation point indicator of the digit style.<br>\- **size**:font size. It cannot be set in percentage.<br>Default value: **14vp**<br>\- **weight**: font weight.| 132| selectedDigitFont | {<br>size?:[Length](ts-types.md#length)<br>weight?:number \| [FontWeight](ts-appendix-enums.md#fontweight) \| string<br>} | No | Font style of the selected navigation point indicator of the digit style.<br>\- **size**:font size. It cannot be set in percentage.<br>Default value: **14vp**<br>\- **weight**: font weight.| 133 134## ArrowStyle<sup>10+</sup> 135Describes the left and right arrow attributes. 136 137| Name | Type | Mandatory. | Description | 138| ---------------- | ---------------------------------------- | ---- | ---------------------------------------- | 139| showBackground | boolean | No | Whether to show the background for the arrow.<br>Default value: **false** | 140| isSidebarMiddle | boolean | No | Whether the arrow is shown on either side of the navigation point indicator.<br>Default value: **false** (the arrow is shown on either side of the navigation point indicator)| 141| backgroundSize | [Length](ts-types.md#length) | No | Size of the background.<br>On both sides of the navigation point indicator:<br>Default value: **24vp**<br>On both sides of the component:<br>Default value: **32vp**<br>This parameter cannot be set in percentage.| 142| backgroundColor | [ResourceColor](ts-types.md#resourcecolor) | No | Color of the background.<br>On both sides of the navigation point indicator:<br>Default value: **'\#00000000'**<br>On both sides of the component:<br>Default value: **'\#19182431'**| 143| arrowSize | [Length](ts-types.md#length) | No | Size of the arrow.<br>On both sides of the navigation point indicator:<br>Default value: **18vp**<br>On both sides of the component:<br>Default value: **24vp**<br>**NOTE**<br>If **showBackground** is set to **true**, the value of **arrowSize** is 3/4 of the value of **backgroundSize**.<br>This parameter cannot be set in percentage.| 144| arrowColor | [ResourceColor](ts-types.md#resourcecolor) | No | Color of the arrow.<br>Default value: **'\#182431'** | 145 146## SwiperAutoFill<sup>10+</sup> 147 148Describes the auto-fill attribute. 149 150| Name | Type | Mandatory.| Description | 151| ------- | -------------------- | ------ | ------------------------------------ | 152| minSize | [VP](ts-types.md#vp10) | Yes | Minimum width of the element.<br>Default value: **0**| 153 154## Events 155 156In addition to the [universal events](ts-universal-events-click.md), the following events are supported. 157 158| Name | Description | 159| ---------------------------------------- | ---------------------------------------- | 160| onChange(event: (index: number) => void) | Triggered when the index of the currently displayed child component changes.<br>- **index**: index of the currently displayed element.<br>**NOTE**<br>When the **\<Swiper>** component is used together with **LazyForEach**, the subpage UI update cannot be triggered in the **onChange** event.| 161| onAnimationStart<sup>9+</sup>(event: (index: number, targetIndex<sup>10+</sup>: number, extraInfo<sup>10+</sup>: [SwiperAnimationEvent](ts-types.md#swiperanimationevent10)) => void) | Triggered when the switching animation starts.<br>- **index**: index of the currently displayed element.<br>- **targetIndex**: index of the target element to switch to.<br>- **extraInfo**: extra information of the animation, including the offset of the currently displayed element and target element relative to the start position of the **\<Swiper>** along the main axis, and the hands-off velocity.<br>**NOTE**<br>The **index** parameter indicates the index before the animation starts (not the one after). When the **\<Swiper>** component contains multiple columns, the index is of the leftmost element.| 162| onAnimationEnd<sup>9+</sup>(event: (index: number, extraInfo: [SwiperAnimationEvent](ts-types.md#swiperanimationevent10)) => void) | Triggered when the switching animation ends.<br>- **index**: index of the currently displayed element.<br>- **extraInfo**: extra information of the animation, which is the offset of the currently displayed element relative to the start position of the **\<Swiper>** along the main axis.<br>**NOTE**<br>This event is triggered when the switching animation of the **\<Swiper>** component ends, whether it is caused by gesture interruption or by calling **finishAnimation** through SwiperController. The **index** parameter indicates the index after the animation ends. When the **\<Swiper>** component contains multiple columns, the index is of the leftmost element.| 163| onGestureSwipe<sup>10+</sup>(event: (index: number, extraInfo: [SwiperAnimationEvent](ts-types.md#swiperanimationevent10)) => void) | Triggered on a frame-by-frame basis when the page is turned by a swipe.<br>- **index**: index of the currently displayed element.<br>- **extraInfo**: extra information of the animation, which is the offset of the currently displayed element relative to the start position of the **\<Swiper>** along the main axis.<br>**NOTE**<br>If there are multiple columns, **index** indicates the index of the leftmost component.| 164 165## Example 166 167### Example 1 168```ts 169// xxx.ets 170class MyDataSource implements IDataSource { 171 private list: number[] = [] 172 173 constructor(list: number[]) { 174 this.list = list 175 } 176 177 totalCount(): number { 178 return this.list.length 179 } 180 181 getData(index: number): number { 182 return this.list[index] 183 } 184 185 registerDataChangeListener(listener: DataChangeListener): void { 186 } 187 188 unregisterDataChangeListener() { 189 } 190} 191 192@Entry 193@Component 194struct SwiperExample { 195 private swiperController: SwiperController = new SwiperController() 196 private data: MyDataSource = new MyDataSource([]) 197 198 aboutToAppear(): void { 199 let list: number[] = [] 200 for (let i = 1; i <= 10; i++) { 201 list.push(i); 202 } 203 this.data = new MyDataSource(list) 204 } 205 206 build() { 207 Column({ space: 5 }) { 208 Swiper(this.swiperController) { 209 LazyForEach(this.data, (item: string) => { 210 Text(item.toString()) 211 .width('90%') 212 .height(160) 213 .backgroundColor(0xAFEEEE) 214 .textAlign(TextAlign.Center) 215 .fontSize(30) 216 }, (item: string) => item) 217 } 218 .cachedCount(2) 219 .index(1) 220 .autoPlay(true) 221 .interval(4000) 222 .indicator(true) 223 .loop(true) 224 .duration(1000) 225 .itemSpace(0) 226 .displayArrow({ 227 showBackground: true, 228 isSidebarMiddle: true, 229 backgroundSize: 24, 230 backgroundColor: Color.White, 231 arrowSize: 18, 232 arrowColor: Color.Blue 233 }, false) 234 .curve(Curve.Linear) 235 .onChange((index: number) => { 236 console.info(index.toString()) 237 }) 238 .onGestureSwipe((index: number, extraInfo: SwiperAnimationEvent) => { 239 console.info("index: " + index) 240 console.info("current offset: " + extraInfo.currentOffset) 241 }) 242 .onAnimationStart((index: number, targetIndex: number, extraInfo: SwiperAnimationEvent) => { 243 console.info("index: " + index) 244 console.info("targetIndex: " + targetIndex) 245 console.info("current offset: " + extraInfo.currentOffset) 246 console.info("target offset: " + extraInfo.targetOffset) 247 console.info("velocity: " + extraInfo.velocity) 248 }) 249 .onAnimationEnd((index: number, extraInfo: SwiperAnimationEvent) => { 250 console.info("index: " + index) 251 console.info("current offset: " + extraInfo.currentOffset) 252 }) 253 254 Row({ space: 12 }) { 255 Button('showNext') 256 .onClick(() => { 257 this.swiperController.showNext() 258 }) 259 Button('showPrevious') 260 .onClick(() => { 261 this.swiperController.showPrevious() 262 }) 263 }.margin(5) 264 }.width('100%') 265 .margin({ top: 5 }) 266 } 267} 268``` 269 270 271 272### Example 2 273```ts 274// xxx.ets 275class MyDataSource implements IDataSource { 276 private list: number[] = [] 277 278 constructor(list: number[]) { 279 this.list = list 280 } 281 282 totalCount(): number { 283 return this.list.length 284 } 285 286 getData(index: number): number { 287 return this.list[index] 288 } 289 290 registerDataChangeListener(listener: DataChangeListener): void { 291 } 292 293 unregisterDataChangeListener() { 294 } 295} 296 297@Entry 298@Component 299struct SwiperExample { 300 private swiperController: SwiperController = new SwiperController() 301 private data: MyDataSource = new MyDataSource([]) 302 303 aboutToAppear(): void { 304 let list: number[] = [] 305 for (let i = 1; i <= 10; i++) { 306 list.push(i); 307 } 308 this.data = new MyDataSource(list) 309 } 310 311 build() { 312 Column({ space: 5 }) { 313 Swiper(this.swiperController) { 314 LazyForEach(this.data, (item: string) => { 315 Text(item.toString()) 316 .width('90%') 317 .height(160) 318 .backgroundColor(0xAFEEEE) 319 .textAlign(TextAlign.Center) 320 .fontSize(30) 321 }, (item: string) => item) 322 } 323 .cachedCount(2) 324 .index(1) 325 .autoPlay(true) 326 .interval(4000) 327 .indicator(Indicator.dot() 328 .itemWidth(15) 329 .itemHeight(15) 330 .selectedItemWidth(15) 331 .selectedItemHeight(15) 332 .color(Color.Gray) 333 .selectedColor(Color.Blue)) 334 .loop(true) 335 .duration(1000) 336 .itemSpace(0) 337 .displayArrow(true, true) 338 339 Row({ space: 12 }) { 340 Button('showNext') 341 .onClick(() => { 342 this.swiperController.showNext() 343 }) 344 Button('showPrevious') 345 .onClick(() => { 346 this.swiperController.showPrevious() 347 }) 348 }.margin(5) 349 }.width('100%') 350 .margin({ top: 5 }) 351 } 352} 353``` 354 355 356### Example 3 357```ts 358// xxx.ets 359class MyDataSource implements IDataSource { 360 private list: number[] = [] 361 362 constructor(list: number[]) { 363 this.list = list 364 } 365 366 totalCount(): number { 367 return this.list.length 368 } 369 370 getData(index: number): number { 371 return this.list[index] 372 } 373 374 registerDataChangeListener(listener: DataChangeListener): void { 375 } 376 377 unregisterDataChangeListener() { 378 } 379} 380 381@Entry 382@Component 383struct SwiperExample { 384 private swiperController: SwiperController = new SwiperController() 385 private data: MyDataSource = new MyDataSource([]) 386 387 aboutToAppear(): void { 388 let list: number[] = [] 389 for (let i = 1; i <= 10; i++) { 390 list.push(i); 391 } 392 this.data = new MyDataSource(list) 393 } 394 395 build() { 396 Column({ space: 5 }) { 397 Swiper(this.swiperController) { 398 LazyForEach(this.data, (item: string) => { 399 Text(item.toString()) 400 .width('90%') 401 .height(160) 402 .backgroundColor(0xAFEEEE) 403 .textAlign(TextAlign.Center) 404 .fontSize(30) 405 }, (item: string) => item) 406 } 407 .cachedCount(2) 408 .index(1) 409 .autoPlay(true) 410 .interval(4000) 411 .indicator(Indicator.digit() 412 .right("43%") 413 .top(200) 414 .fontColor(Color.Gray) 415 .selectedFontColor(Color.Gray) 416 .digitFont({ size: 20, weight: FontWeight.Bold }) 417 .selectedDigitFont({ size: 20, weight: FontWeight.Normal })) 418 .loop(true) 419 .duration(1000) 420 .itemSpace(0) 421 .displayArrow(true, false) 422 423 Row({ space: 12 }) { 424 Button('showNext') 425 .onClick(() => { 426 this.swiperController.showNext() 427 }) 428 Button('showPrevious') 429 .onClick(() => { 430 this.swiperController.showPrevious() 431 }) 432 }.margin(5) 433 }.width('100%') 434 .margin({ top: 5 }) 435 } 436} 437``` 438 439