Carousel

Scroll snap React carousel with previous and next buttons, arrow key support and a labelled region. Shows one, two or three slides by breakpoint, no library.

src/registry/ui/carousel.tsx/r/carousel.json

Installation#

bash
npx shadcn@latest add @minidev/carousel

MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/carousel.json

Usage#

tsx
import { Carousel } from "@/components/ui/carousel"

export function Example() {
  return (
    <Carousel>
      {[1,2,3,4].map((n) => (
        <Card key={n}><CardHeader><CardTitle>Slide {n}</CardTitle></CardHeader><CardContent className="text-sm text-fg-muted">Carousel card content.</CardContent></Card>
      ))}
    </Carousel>
  )
}

API reference#

Carousel props
PropTypeDefault
children*React.ReactNode-
classNamestring-
labelstring"Carousel"

* required

Dependencies#

npm

lucide-react

Built from

Examples#

All media and upload components

Learn more