Accessible carousel with previous/next controls and optional slide indicators
Carousel Component
An accessible carousel for sliding content. Includes previous/next buttons and optional dot indicators. Uses role="region" and aria-roledescription="carousel" for screen readers.
Add this component
Run the command below in your project directory. When prompted, select the component(s) you want. The CLI will copy the CSS and component files.
Choose your package manager — click a tab to select, then copy the command.
npm pnpm yarn bun
bashbash
npx rizzo-css add
bashbash
pnpm dlx rizzo-css add
bashbash
npx rizzo-css add
bashbash
bunx rizzo-css add
Props
id (string, optional) — Unique id for the carousel (auto-generated if omitted)
showIndicators (boolean, optional) — Show dot indicators (default: true)
label (string, optional) — Accessible label for the region (default: "Carousel")
class (string, optional) — Additional CSS classes
Slots
Place one or more elements with class carousel__slide as direct children. Each slide is shown one at a time.
Live Example
Carousel
Slide 1
First slide content. Use previous/next or the indicators to navigate.
Slide 2
Second slide content.
Slide 3
Third slide content.
Usage
Usage
Full example for each framework (Astro, Vanilla, Svelte, Vue, React). Switch framework via View as or by clicking a Usage tab—both stay in sync.