Carousel
A horizontal, accessible slideshow built on native scroll + CSS scroll-snap. Slides are the component's default-slot children — one direct child per slide — so you drop arbitrary markup in and the piece measures the count. Prev / next arrows, a clickable dot row, arrow-key nav, and optional autoplay come built in.
Installation
Copy the piece into your app — it compiles with your build and the code is yours:
puzzle add piece carousel
Requires the pieces.css tokens merged into your app styles (see Introduction).
Usage
import Carousel from '@/components/ui/Carousel.pzl';
<Carousel class="w-full max-w-xl"></Carousel>
Autoplay
Loop + controlled index
Active slide: 1 of 3
Dots only (no arrows)
Keyboard
Tab to the carousel region (or any of its buttons), then:
- Left / Right arrow — previous / next slide
- Home / End — jump to the first / last slide
- Dots — each dot is a real button; Tab to it and press Enter / Space to jump
- Autoplay — pauses while the pointer is over the carousel or focus lives inside it, and is disabled entirely under
prefers-reduced-motion - Announcements — a polite live region reports “Slide N of M” as the active slide changes