Carousel: Autoplay
autoplay is off by default and stays off with reduced motion. It pauses on hover, keyboard focus, touch, drag, a hidden tab, or when scrolled out of view, and the active dot fills as the timer runs.
This adds the example as components/examples/carousel/autoplay.tsx, together with the Carousel component and the HextaUI theme tokens it needs.
pnpm dlx shadcn@latest add https://hextaui.com/r/carousel-autoplay.jsonTo add only the component, follow the Carousel installation.
Props in this example
The Carousel props this example sets, from the API reference.
| Prop | Type | Default |
|---|---|---|
autoplayAdvance on a timer. delay defaults to 5000ms, minimum 1000ms. | boolean | { delay?: number } | false |
Every prop is in the Carousel API reference.
- API
- Several per view
- Dots and counter
- Thumbnails
- Vertical
- Controlled
- Rewind and start index
- Links and focusable content
- Adding and removing slides
- Nested
- Long content and a single slide
- Right to left
See them all, with keyboard support and accessibility notes, on the Carousel page.
- ButtonButtons in every variant and size, with a built-in loading, success and error flow that skips the spinner for fast requests.
- Number flowAnimated numbers where only the changed digits spin, with any Intl format and locale.
- AccordionStacked headings that each reveal a panel, with height motion you can reverse mid-way and panels that stay searchable while closed.
- Aspect ratioA box that holds its shape before media loads, shimmers while loading, fades the media in and falls back when it fails.
- CollapsibleA panel that shows and hides with height motion you can reverse mid-way, without jumping the layout.
- ResizablePanels you can drag apart, with a quiet divider that wakes up on hover, sizes that glide on reset or collapse, and layouts that persist.