Skip to content
Cojeev UI

Carousel

Navigation

Lets readers move through a horizontal collection of slides using scrolling and navigation controls.

React · copy into your project · light and dark themes

Try it

Loading preview…

Take it with you

Copy the example, API and usage notes for your editor or AI assistant.

Add to your project

Terminal
npx shadcn@latest add https://luv-jeri.github.io/cojeev-ui/r/carousel.json

The command includes the component’s shared dependencies. Your project keeps editable source files.

Include the complete example

This example also composes badge, card, typography. Install its parts together:

Terminal
npx shadcn@latest add https://luv-jeri.github.io/cojeev-ui/r/carousel.json https://luv-jeri.github.io/cojeev-ui/r/badge.json https://luv-jeri.github.io/cojeev-ui/r/card.json https://luv-jeri.github.io/cojeev-ui/r/typography.json

Using carousel

  • Place CarouselItem elements inside CarouselContent and add Previous, Next, or Dot controls as needed.

  • Use onIndexChange to synchronize a slide count or related content with the current position.

API

Compose the exported parts below. The prop types are read from the React source during the registry build.

Native element or underlying primitive props are inherited where declared, including accessible labels, event handlers and refs.

CarouselProps

PropTypeRequired
onIndexChange(index: number) => voidNo

CarouselContentProps

Accepts the native or primitive props declared by its exported TypeScript type.

CarouselItemProps

PropTypeRequired
asChildbooleanNo

CarouselNavigationProps

Accepts the native or primitive props declared by its exported TypeScript type.

CarouselPreviousProps

Accepts the native or primitive props declared by its exported TypeScript type.

CarouselNextProps

Accepts the native or primitive props declared by its exported TypeScript type.

CarouselDotsProps

Accepts the native or primitive props declared by its exported TypeScript type.

CarouselDotProps

PropTypeRequired
indexnumberYes

CarouselDeckProps

Accepts the native or primitive props declared by its exported TypeScript type.

Accessibility

  • Give the carousel region an accessible name and provide descriptive slide content.

  • Retain the labeled navigation buttons and the content keyboard handler when composing custom controls.

States and appearance

resthoverfocusactive

For conditional content, keep a MotionPresence boundary around keyed MotionSurface children. The shared entrance and exit states work with native primitives and respect your motion preference.

Try pointer and keyboard interaction, and switch the appearance control in the navigation to compare light and dark mode. Motion respects reduced motion preferences.