Component reference
Carousel
A browsable product gallery with image descriptions.
Preview
Live previewOptional six-digit hex. Clear to restore the preset. Check contrast with your brand color.
Changes apply to this preview only.
Width adapts to the available space
"use client";
import {
Carousel,
Card,
Image,
CardHeader,
CardTitle,
Badge,
CardDescription,
CardContent,
Button
} from "@pimolu/react";
const products = [
{
name: "Pimolu Studio",
price: "€49",
description: "Tokens, themes and a component gallery for product teams.",
},
{
name: "Pimolu Native",
price: "€39",
description: "Cross-platform primitives with the same visual contract.",
},
{
name: "Pimolu Icons",
price: "€19",
description: "A consistent icon set tuned for every preset.",
},
];
export function DemoExample() {
return (
<Carousel aria-label="Product gallery" loop showDots>
{
products.map((product) => (<Card key={product.name}>
<Image
src="/images/pimolu-studio.webp"
alt={`${product.name} cover`}
aspectRatio={16 / 9}
fit="cover"
rounded="none"
width={400}
height={300}
/>
<CardHeader>
<div
className="flex flex-wrap items-center gap-3 min-w-0 justify-between"
>
<CardTitle>
{product.name}
</CardTitle>
<Badge variant="secondary">
{product.price}
</Badge>
</div>
<CardDescription>
{product.description}
</CardDescription>
</CardHeader>
<CardContent>
<Button size="sm">View product</Button>
</CardContent>
</Card>))
}
</Carousel>
);
}More examples
Different configurations and compositions using the real Pimolu API. Each preview runs independently and follows the site appearance.
Basic
Three slides, controls and dots. The previous button is disabled on the first slide until loop is enabled.
Autoplay and loop
Autoplay pauses while the pointer or keyboard focus is inside, from the pause control, and stays still when the user prefers reduced motion.
Controlled
The parent owns the index and receives every navigation, including clicks on the dots.
Usage
Keep navigation explicit; autoplay must be optional and pauseable when enabled.
API reference
Generated from the public TypeScript declarations. Native HTML attributes are inherited where the component extends them; this reference includes Pimolu props and selected common native attributes.
PimoluCarouselLabels
Type source| Name | Type | Default | Description |
|---|---|---|---|
previousRequired | string | — | Accessible name of the previous control. |
nextRequired | string | — | Accessible name of the next control. |
pauseRequired | string | — | Accessible name of the pause control. |
playRequired | string | — | Accessible name of the play control. |
paginationRequired | string | — | Accessible name of the dot list. |
slideRequired | (index: number, total: number) => string | — | Accessible name of a slide, for example "2 of 4". |
goToSlideRequired | (index: number, total: number) => string | — | Accessible name of a dot, for example "Go to slide 2". |
previousRequiredstringNo default extracted.
Accessible name of the previous control.
nextRequiredstringNo default extracted.
Accessible name of the next control.
pauseRequiredstringNo default extracted.
Accessible name of the pause control.
playRequiredstringNo default extracted.
Accessible name of the play control.
paginationRequiredstringNo default extracted.
Accessible name of the dot list.
slideRequired(index: number, total: number) => stringNo default extracted.
Accessible name of a slide, for example "2 of 4".
goToSlideRequired(index: number, total: number) => stringNo default extracted.
Accessible name of a dot, for example "Go to slide 2".
PimoluCarouselProps
Type source| Name | Type | Default | Description |
|---|---|---|---|
childrenRequired | ReactNode | — | Slides. Each direct child becomes one scroll-snapped slide. |
index | number | undefined | — | Controlled active index (zero-based). |
defaultIndex | number | undefined | 0 | Initial index when uncontrolled. Defaults to 0. |
onIndexChange | ((index: number) => void) | undefined | — | Called with the new index when navigation changes it. |
autoPlay | boolean | undefined | false | Advances automatically. Defaults to false. |
interval | number | undefined | 5000 | Autoplay delay in milliseconds. Defaults to 5000. |
loop | boolean | undefined | false | Wraps from the last slide to the first one. Defaults to false. |
showControls | boolean | undefined | true | Shows the previous and next buttons. Defaults to true. |
showDots | boolean | undefined | true | Shows the pagination dots. Defaults to true. |
showPauseControl | boolean | undefined | true | Shows a pause/play control while autoplay is enabled. Defaults to true. |
pauseOnHover | boolean | undefined | true | Pauses autoplay while the pointer hovers the carousel or focus is inside it. Defaults to true. |
labels | Partial<PimoluCarouselLabels> | undefined | — | Overrides the built-in accessible labels. |
viewportClassName | string | undefined | — | Class applied to the scroll viewport. |
slideClassName | string | undefined | — | Class applied to every slide wrapper. |
defaultValue | string | number | readonly string[] | undefined | — | Standard React/HTML attribute. |
className | string | undefined | — | Standard React/HTML attribute. |
style | CSSProperties | undefined | — | Standard React/HTML attribute. |
aria-label | string | undefined | — | Defines a string value that labels the current element. |
onClick | MouseEventHandler<HTMLDivElement> | undefined | — | Standard React/HTML attribute. |
childrenRequiredReactNodeNo default extracted.
Slides. Each direct child becomes one scroll-snapped slide.
indexnumber | undefinedNo default extracted.
Controlled active index (zero-based).
defaultIndexnumber | undefinedDefault: 0
Initial index when uncontrolled. Defaults to 0.
onIndexChange((index: number) => void) | undefinedNo default extracted.
Called with the new index when navigation changes it.
autoPlayboolean | undefinedDefault: false
Advances automatically. Defaults to false.
intervalnumber | undefinedDefault: 5000
Autoplay delay in milliseconds. Defaults to 5000.
loopboolean | undefinedDefault: false
Wraps from the last slide to the first one. Defaults to false.
showControlsboolean | undefinedDefault: true
Shows the previous and next buttons. Defaults to true.
showDotsboolean | undefinedDefault: true
Shows the pagination dots. Defaults to true.
showPauseControlboolean | undefinedDefault: true
Shows a pause/play control while autoplay is enabled. Defaults to true.
pauseOnHoverboolean | undefinedDefault: true
Pauses autoplay while the pointer hovers the carousel or focus is inside it. Defaults to true.
labelsPartial<PimoluCarouselLabels> | undefinedNo default extracted.
Overrides the built-in accessible labels.
viewportClassNamestring | undefinedNo default extracted.
Class applied to the scroll viewport.
slideClassNamestring | undefinedNo default extracted.
Class applied to every slide wrapper.
defaultValuestring | number | readonly string[] | undefinedNo default extracted.
Standard React/HTML attribute.
classNamestring | undefinedNo default extracted.
Standard React/HTML attribute.
styleCSSProperties | undefinedNo default extracted.
Standard React/HTML attribute.
aria-labelstring | undefinedNo default extracted.
Defines a string value that labels the current element.
onClickMouseEventHandler<HTMLDivElement> | undefinedNo default extracted.
Standard React/HTML attribute.
Accessibility
- Test previous/next and slide announcements, and respect reduced-motion preferences.
