Carousel
A touch-friendly, accessible slideshow for cycling through items, powered by Embla.
Install
Pull Carousel from the barrel for everyday use, or the granular path when you want a tighter bundle.
import { Carousel } from "@brika/clay";import { Carousel } from "@brika/clay/components/carousel";A minimal example
Drop this into a page. Native HTML attributes pass through to the underlying primitive.
import { Card, CardContent } from '@brika/clay/components/card';
import {
Carousel,
CarouselContent,
CarouselItem,
CarouselNext,
CarouselPrevious,
} from '@brika/clay/components/carousel';
const SLIDES_5 = [1, 2, 3, 4, 5] as const;
export default function CarouselDefaultDemo() {
return (
<Carousel className="w-full max-w-xs">
<CarouselContent>
{SLIDES_5.map((n) => (
<CarouselItem key={n}>
<Card>
<CardContent className="flex aspect-square items-center justify-center p-6">
<span className="font-semibold text-4xl">{n}</span>
</CardContent>
</Card>
</CarouselItem>
))}
</CarouselContent>
<CarouselPrevious />
<CarouselNext />
</Carousel>
);
}Carousel, every way
Multiple
Accessibility
- Root carries
role="region"with a label; each slide hasrole="group" aria-roledescription="slide". - Previous/Next buttons include
sr-onlyscreen-reader labels. - Left/Right arrow keys navigate slides while focus is inside the carousel.
- Autoplay should pause on hover and focus to respect user attention and
prefers-reduced-motion.
API reference
Props specific to Carousel. Native HTML attributes pass through to the underlying primitive, see the component source on GitHub for the full type signature.
<Carousel />
4 props- CarouselOptionsEmbla carousel options (e.g.
{ loop: true, align: 'start' }). - orientationdefault
'horizontal''horizontal' | 'vertical'Scroll axis,"horizontal"(default) or"vertical". - CarouselPluginEmbla plugins (e.g. Autoplay).
- (api: CarouselApi) => voidCallback that receives the Embla API instance once initialized.
<CarouselContent />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.
<CarouselContext />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.
<CarouselItem />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.
<CarouselNext />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.
<CarouselPrevious />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.