import BaseStyles from './_snippets/base-styles.md' import BoxStyles from './_snippets/box-styles.md' import { EnsemblePreview } from '../../components/ensemble-preview'
The Carousel Widget allows you to create and render carousels, enabling the presentation of multiple items in a visually engaging and interactive slideshow format within your application.
| Property | Type | Description |
|---|---|---|
| children | array | List of widgets |
| onItemChange | action | Dispatch when an carousel item is in focus. For SingleView, this happens when the item is scroll into view. For scrolling MultiView, the event dispatches only when you tap on the item. The index of the item can be retrieved using 'selectedIndex'. |
| item-template | object | See properties |
| Property | Type | Description |
|---|---|---|
| layout | string | Show a SingleView (on screen one at a time), MultiView (scrolling items), or automatically switch between the views with autoLayoutBreakpoint |
| autoLayoutBreakpoint | integer | Show multiple views on the carousel if the breakpoint is equal or larger than this threshold, otherwise show single view. (default 768) |
| autoplay | boolean | If true, Enables autoplay, sliding one page at a time. Default (false) |
| autoplayInterval | integer | Sets the duration in seconds for the autoplay. Default (4 second) |
| height | integer | The height of each view |
| gap | integer | The gap between each views, but also act as a left-right margin in a single view |
| leadingGap | integer | The space before the first item. Note that the left edge of the scroll area is still controlled by padding or margin. |
| trailingGap | integer | The space after the last item. Note that the right edge of the scroll area is still controlled by padding or margin. |
| singleItemWidthRatio | number | The screen width ratio for each carousel item (in single item mode). Value ranges from 0.0 to 1.0 for the full width. (default 1.0) |
| multipleItemWidthRatio | number | The screen width ratio for each carousel item (in multiple item mode). Value ranges from 0.0 to 1.0 for the full width (default 0.6) |
| scrollType | string | Allows you to set the scroll physics for the carousel. Default For iOS it is bouncing else it is clamping. Possible values are bouncing, clamping, neverScrollable, alwaysScrollable. |
| indicatorType | string | How the view indicator should be displayed |
| indicatorPosition | string | Where to display the indicator if specified |
| indicatorWidth | integer | Sets the width of the carousel indicators within the Carousel |
| indicatorHeight | integer | Adjusts the height of the carousel indicators within the Carousel |
| indicatorMargin | string or integer | The margin around each indicator |
| indicatorPadding | string or integer | The padding around the indicator |
| aspectRatio | number | Aspect ratio is used if no height have been declared. |
| autoPlayAnimationDuration | integer | The animation duration between two transitioning pages while in auto playback. |
| autoPlayCurve | string | Determines the animation curve physics. |
| enlargeCenterPage | boolean | Determines if current page should be larger than the side images, creating a feeling of depth in the carousel. |
| enlargeFactor | number | How much the pages next to the center page will be scaled down. If enlargeCenterPage is false, this property has no effect. |
| direction | string | The axis along which the carousel view scrolls. |
| cacheKey | string | Pass a cacheKey if you want to keep the carousel's item position when it was recreated |
| buildOnDemand | boolean | Build the carousel items only when its visible in the screen. Default - false |
| buildOnDemandLength | integer | Build the carousel items when its visible in the screen only when the item is greater or equal to this length. Default - 6 |
| colorFilter | object | Applies color filter to whole carousel |
This widget also inherits these styles
This widget also inherits these styles
| Property | Type | Description |
|---|---|---|
| data | string | Bind to an array of data from an API response or a variable |
| name | string | Set the name to reference as you iterate through the array of data |
| template | widget | The widget to render for each item |