Skip to contentKino
Skip to Content

Carousel

Slides seen a few at a time, moved by a drag, Previous and Next, the dots and the arrow keys. The track slides a row along; the deck throws cards off a stack.

npx shadcn add https://kinoui.com/r/carousel.json
Share on

Examples

What’s new in Kino

The last five releases.

Default

The row follows a drag, gives a little at the ends, and a flick carries it on, settling sooner the faster it went.

What teams say

From the teams who switched this year.

Deck

With variant="deck" the slides are a stack: drag the top card off either way, or press Next, and it goes to the bottom while the rest step up.

Start from a template

Made by teams who run Kino every day.

Several in view

Give each slide its width with basis-*, less the gaps. Previous and Next, and each dot, move a whole view at a time.

Controlled

Hold the value to move it from outside, here from the thumbnails. It is the first slide in view, from 0.

Installation

npx shadcn@latest add https://kinoui.com/r/carousel.json
Files
lib/refs.tslib/reduce-motion.tslib/resize.tslib/swap.tsxcomponents/kino/spinner.tsxcomponents/kino/button.tsxlib/number-format.tslib/roll.tsxlib/run-progress.tscomponents/kino/animated-number.tsxlib/announce.tsxlib/swipe.tscomponents/kino/carousel.tsx
Packages
@base-ui/reactclass-variance-authority

New to Kino? Installation covers what your project needs first and the @kino namespace.

API reference

PropTypeDefaultDescription
variant'track''deck''track'A row that slides along under a window, or a stack of cards whose top one is thrown off.
valuenumberNoneThe first slide in view, from 0, when you hold the state. One past the last slide that can come first shows that slide instead.
defaultValuenumber0The first slide in view at first, when it holds its own state.
onValueChange(value: number) => voidNoneCalled with the new first slide in view.
loopbooleanfalseNext on the last page goes to the first, and Previous on the first to the last. The deck always loops.

Data attributes

AttributeOnDescription
data-variantCarouseltrack or deck.
data-followingCarouselPresent while a drag moves the slides.
data-topCarouselItemPresent on the deck’s top card.

CSS variables

VariableSet it onDefaultDescription
--carousel-recedeCarousel, or anything above it0.75remHow far each card under the deck’s top one sits lower.
--carousel-recede-scaleCarousel, or anything above it0.05How much smaller each card under the deck’s top one gets.
--carousel-slideCarousel, or anything above it60%How far a thrown card travels on from where it was let go.
--carousel-tiltCarousel, or anything above it8degHow far the deck’s top card tilts as it is dragged its width.

Accessibility

  • It follows the carousel pattern: a region named with aria-label, each slide a group named by its place, and a live region that says what is in view once it changes. Nothing is said on load, and it never turns slides on its own.
  • The arrow keys move a page from Previous, Next or the dots. In a slide they belong to what is there, such as a field.
  • Tab goes through what is in the slides; a slide focused out of view comes into it.
  • A drag is never the only way: Previous, Next and the dots do the same.
  • On the deck only the top card can be read and used; the cards under it are a picture of the stack.
  • When the system asks for less motion, the slides move to their place at once.