Skip to main content

Carousel

A scroll-snap carousel with spring slide effects, gliding dots, keyboard navigation and pointer drag.

Spatial Dialog
Launches from trigger bounds with spring physics.
Overlay
Slide 01 / 05
Elastic Slider
Rubber-band boundary pull with velocity tilt.
Input
Slide 02 / 05
Spotlight Card
Linear spotlight glow and spring hover lift.
Display
Slide 03 / 05
Blur Select
Staggered item entrance and rolling readout.
Input
Slide 04 / 05
Sliding Tabs
Shared spring indicator with weighted hover pill.
Navigation
Slide 05 / 05
slide=1/ 5·effect="focus"

Customize

Speed1

Installation

npx shadcn@latest add @kinetic/carousel

Usage

Put slides in CarouselContent as CarouselItems and add the controls you need.

import {
  Carousel,
  CarouselContent,
  CarouselDots,
  CarouselItem,
  CarouselNext,
  CarouselPrevious,
} from "@/components/kinetic/ui/carousel";

export function Gallery() {
  return (
    <Carousel className="mx-12 max-w-md">
      <CarouselContent>
        {[1, 2, 3].map((n) => (
          <CarouselItem key={n} className="basis-3/4">
            <div className="flex aspect-video items-center justify-center rounded-lg border">{n}</div>
          </CarouselItem>
        ))}
      </CarouselContent>
      <CarouselPrevious />
      <CarouselNext />
      <CarouselDots />
    </Carousel>
  );
}

Effects

Set effect to focus (scale and fade toward the center slide), depth (a layered shift), or none for plain scroll snapping.

<Carousel effect="depth">...</Carousel>

Orientation

Set orientation="vertical" to scroll on the vertical axis. Arrow keys and controls follow the axis.

<Carousel orientation="vertical" className="h-72">...</Carousel>

Options

opts takes align (start, center, end), startIndex and loop. Control slide width with basis-* classes on CarouselItem.

<Carousel opts={{ align: "start", loop: true }}>...</Carousel>

API

setApi hands you an object with scrollPrev, scrollNext, scrollTo, selectedScrollSnap, on and off. Inside the carousel, useCarousel() reads the same state.

const [api, setApi] = useState<CarouselApi | null>(null);

<Carousel setApi={setApi}>...</Carousel>

Motion preferences

Use speed to scale the slide springs, arrow nudges and dot transitions. Reduced motion keeps scroll snapping and drops the slide effects.

API Reference

Carousel

Zero-dependency native scroll-snap carousel region with Euler spring focus/depth effects, keyboard navigation, and live slide announcements.

PropTypeDefaultDescription
orientation"horizontal" | "vertical""horizontal"Scroll axis for slides, arrow keys, and navigation controls.
effect"focus" | "depth" | "none""focus"Spring scroll-linked slide treatment: subtle scale/opacity focus attenuation, depth shift ('parallax' alias also accepted), or plain scroll snap.
optsCarouselOptions{ align: "center", loop: false }Scroll options including align ('start' | 'center' | 'end'), loop, startIndex, and axis.
loopbooleanfalseWraps previous/next and dot keyboard navigation past the first or last slide.
speednumber1Speed multiplier for slide spring effects, nav chevron nudges, dot transitions, and scroll settle detection (clamped 0.25-4).
setApi(api: CarouselApi) => void-Callback providing the imperative CarouselApi (scrollPrev, scrollNext, scrollTo, selectedScrollSnap, on, off).

CarouselContent / CarouselItem / CarouselPrevious / CarouselNext / CarouselDots / useCarousel

Scroll viewport, slide item slot, Button-backed navigation arrows with spring nudges and boundary focus recovery, velocity-stretching indicator dots, and context hook.

PropTypeDefaultDescription
variant / size (CarouselPrevious / CarouselNext)Button["variant"] / Button["size"]variant="outline", size="icon"Button appearance and sizing forwarded to previous/next arrow controls.
tabIndex (CarouselContent)number0Keeps the scroll container keyboard-reachable for scrolling and focus fallback.
aria-label (CarouselDots)string"Choose a slide"Accessible group label for the spring-animated slide marker dots.

Notes

CarouselPrevious and CarouselNext sit outside the track at -left-12 / -right-12 (or -top-12 / -bottom-12 for vertical); add matching padding such as px-12 on an outer wrapper to avoid clipping.