# Carousel
> Swipeable slides with arrows, dots, looping and auto-play.
Source: https://native.shellui.dev/docs/components/data-display/carousel
## Installation
```bash
shellui-native add carousel
```
**Platforms:** MAUI ยท Avalonia. Also installs `icon`.
## Usage
### Basic
**MAUI**
```xml
```
**Avalonia**
```xml
```
[Live preview](https://native.shellui.dev/preview/index.html?c=carousel-basic)
## MAUI and Avalonia
- On Avalonia you drag slides with the mouse as well as with touch.
- The Avalonia arrows are tab stops, and Left / Right change the slide while one has focus.
- With `AspectRatio="0"`, give the carousel a height: `HeightRequest` on MAUI, `Height` on Avalonia.
## API
XAML children go to `Slides`.
| Property | Type | Default | Description |
|---|---|---|---|
| `Position` | `int` | `0` | Index of the current slide. Two-way bindable. |
| `Loop` | `bool` | `true` | At the last slide, Next wraps to the first (and Previous the other way). |
| `ShowArrows` | `bool` | `true` | Shows the previous / next buttons. |
| `ShowDots` | `bool` | `true` | Shows the position dots. |
| `AutoPlay` | `bool` | `false` | Advances slides on a timer. |
| `AutoPlayInterval` | `int` | `3000` | Milliseconds between slides while AutoPlay is on. |
| `AspectRatio` | `double` | 16 : 9 (`1.7778`) | Width / height of the frame. 0 turns it off: set HeightRequest on the carousel instead. |
| Event | Arguments | Description |
|---|---|---|
| `PositionChanged` | `int` | User input only (arrows, dots, swipes, keys): auto-play, Next / Previous and setting Position from code don't raise it. |
| Method | Description |
|---|---|
| `Next()` | Shows the next slide. |
| `Previous()` | Shows the previous slide. |