Navigation
Carousel
A single-slide-per-view carousel with prev/next arrows and dot indicators — conceptually a Tabs where the panels rotate, not a multi-slide gallery.
CarouselPreview
Usage
tsx
import { Carousel } from "@vesture/react";
function Example() {
return (
<Carousel autoPlay autoPlayInterval={4000}>
<div style={{ padding: 40 }}>Slide one</div>
<div style={{ padding: 40 }}>Slide two</div>
<div style={{ padding: 40 }}>Slide three</div>
</Carousel>
);
}Behavior
- Renders one slide at a time via a CSS transform, not multi-slide-per-view — each child of Carousel is one full slide.
- autoPlay pauses on hover or focus anywhere within the carousel and resumes on mouseleave/blur, so it never advances while a visitor is actively looking at it.
- prefers-reduced-motion disables autoPlay entirely (not just the slide transition's CSS animation) — continuous automatic content change is itself a motion-sensitivity concern.
- loop wraps at both boundaries when true; when false, the arrows disable at the first/last slide instead of wrapping.
- Left/Right arrow keys navigate whenever the carousel or one of its controls has focus, in addition to clicking an arrow or a dot.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| children | ReactNode[] | — | Required. Each child is one full-width slide. |
| autoPlay | boolean | false | Advances automatically on a timer; pauses on hover/focus. |
| autoPlayInterval | number | 5000 | Milliseconds between automatic advances. |
| loop | boolean | true | Wraps at the first/last slide instead of disabling the arrows there. |
| showArrows | boolean | true | Shows the prev/next arrow buttons. |
| showDots | boolean | true | Shows the clickable dot indicators. |