Layout
Carousel
Also calledslideshowcontent sliderslide gallery
A sequence of slides or items shown in the same space, with controls for moving between them.
How people describe it
- “pictures you move through with left and right arrows”
- “one featured item at a time with next and previous controls”
- “row of dots underneath changing pictures”
Good for
- Browsing a small set of featured items
- Manually browsing product photos
Don’t mix it up with
Uses labeled choices for direct access to panels rather than moving through a slide sequence.
What your library calls it
| LIBRARY | CALLS IT |
|---|---|
| shadcn/ui | Carousel |
Accessibility checklist
- Give the carousel and its controls accessible names
- Keep focus on controls and announce manual slide changes politely
- Keep inactive slides out of navigation and avoid autoplay
Try it
Mountains
Use arrows, dots, or Pause. Autoplay pauses on hover, focus, and reduced motion.
Settings
Colors
Pick, eyedrop, or generate a color, then choose Custom under Color above.
Passes AA · 6.9:1
Text color is chosen for you.
Start
End
Prompt
Add a carousel with labeled previous and next buttons. Keep autoplay off.
~19 estimated prompt tokensDetailed: ~77 estimated prompt tokens
Rough estimate for prompt text only; actual counts vary by model and context.
"use client";
import { useState } from "react";
const slides = [
{ title: "Plan your garden", text: "Choose plants that suit your space." },
{ title: "Prepare the soil", text: "Give roots room and good drainage." },
{ title: "Water consistently", text: "Check the soil before watering." },
];
export function GuideCarousel() {
const [index, setIndex] = useState(0);
const slide = slides[index];
return (
<section aria-label="Gardening guides" aria-roledescription="carousel">
<div role="group" aria-roledescription="slide" aria-label={`${index + 1} of ${slides.length}`}>
<h2>{slide.title}</h2>
<p>{slide.text}</p>
</div>
<div className="flex flex-wrap items-center gap-2">
<button type="button" className="min-h-11 min-w-11 px-3 focus-visible:outline-2" aria-label="Previous slide" onClick={() => setIndex((i) => (i - 1 + slides.length) % slides.length)}>Previous</button>
<button type="button" className="min-h-11 min-w-11 px-3 focus-visible:outline-2" aria-label="Next slide" onClick={() => setIndex((i) => (i + 1) % slides.length)}>Next</button>
</div>
<p role="status" aria-atomic="true">Slide {index + 1} of {slides.length}: {slide.title}</p>
</section>
);
}Used in
Explore website blueprints that use this component.