Loading...
Installation
Install the following dependencies:
Copy and paste the following code into your project.
Loading...
Update the import paths to match your project setup.
Composition
Carousel ├── CarouselContent │ └── CarouselItem ├── CarouselControl │ ├── CarouselPrevious │ └── CarouselNext ├── CarouselIndicators | CarouselIndicatorGroup (optional) │ └── CarouselIndicator └── CarouselAutoplayTrigger (optional)
Examples
Default
Loading...
Image Gallery
Loading...
In A Card
Loading...
Multiple Items
Loading...
Vertical
Loading...
With Indicators
Loading...
API Reference
Carousel
| Prop | Type | Default | Description |
|---|---|---|---|
id | string | undefined | — | Unique identifier used to connect the component parts. |
ids | ElementIds | undefined | — | Overrides generated identifiers for individual parts. |
translations | IntlTranslations | undefined | — | Configures translations. |
slidesPerPage | number | undefined | — | Configures slides per page. |
autoSize | boolean | undefined | — | Configures auto size. |
slidesPerMove | number | "auto" | undefined | — | Configures slides per move. |
autoplay | boolean | { delay: number | — | Configures autoplay. |
allowMouseDrag | boolean | undefined | — | Configures allow mouse drag. |
loop | boolean | undefined | false | Loops keyboard or carousel navigation at the ends. |
page | number | undefined | — | Configures page. |
defaultPage | number | undefined | — | Configures default page. |
spacing | string | undefined | — | Configures spacing. |
padding | string | undefined | — | Configures padding. |
onPageChange | ((details: PageChangeDetails) => void) | undefined | — | Runs when page changes. |
inViewThreshold | number | number[] | undefined | — | Configures in view threshold. |
snapType | "proximity" | "mandatory" | undefined | — | Configures snap type. |
onDragStatusChange | ((details: DragStatusDetails) => void) | undefined | — | Runs when drag status changes. |
onAutoplayStatusChange | ((details: AutoplayStatusDetails) => void) | undefined | — | Runs when autoplay status changes. |
Context, Hooks, and Types
| Export | API |
|---|---|
CarouselContext | Render-prop component that exposes component state and actions. |
CarouselRootProvider | Provides an externally created API to the component tree. |
useCarousel | Creates or accesses the component API. |
useCarouselContext | Returns the nearest component API. |
Angular
React
Solid
Svelte
Vue