Carousel
Slides that snap one at a time as they scroll, with previous and next buttons. There is no autoplay.
Import
import { Carousel } from '@k8ordo/ui';Usage
The track is a scroll container. Besides the buttons, a trackpad or a swipe moves it, and so do the arrow keys once the track has focus. When one slide shows at a time, the position is shown as “2 / 4”.
<Carousel.Root label="Seasons">
{seasons.map((season) => (
<Carousel.Slide key={season} label={season}>
<SeasonCard season={season} />
</Carousel.Slide>
))}
</Carousel.Root>Slide size
slideSize is how much of the track one slide takes: full is one, lg lets the next one peek in, md is two and sm is three. With several in view there is no single current slide, so no position is shown.
<Carousel.Root label="Seasons" slideSize="md">
…
</Carousel.Root>Props
Carousel.Root
label- Type:
string - Default: -
children?- Type:
ReactNode - Default: -
slideSize?- Type:
'full'|'lg'|'md'|'sm' - Default:
'full'
| Prop | Type | Default |
|---|---|---|
label | string | - |
children? | ReactNode | - |
slideSize? | 'full'|'lg'|'md'|'sm' | 'full' |
The wording this component draws (labels, placeholders, and so on) comes from the message dictionary unless a prop sets it. To replace it, see: i18n
Carousel.Slide
children?- Type:
ReactNode - Default: -
label?- Type:
string - Default: -
| Prop | Type | Default |
|---|---|---|
children? | ReactNode | - |
label? | string | - |
The wording this component draws (labels, placeholders, and so on) comes from the message dictionary unless a prop sets it. To replace it, see: i18n