Carousel
A carousel is a sleek, rotating display for images or videos, showcasing one at a time and highlighting multiple pieces of content seamlessly and interactively.
Installation
Install the component via the CLI in one command.
npx shadcn@latest add @intentui/carousel
Composed components
When you install this component via the CLI, it automatically loads all composed components, so you don’t need to add them individually.
Manual installation
Use this approach if you prefer to install and wire up the component yourself instead of using the CLI.
npm install react-aria-components embla-carousel-react @heroicons/react
Anatomy
import {
Carousel,
CarouselButton,
CarouselContent,
CarouselHandler,
CarouselItem,
} from "@/components/ui/carousel"<Carousel>
<CarouselContent>
<CarouselItem className="basis-1/2">Slide 1</CarouselItem>
<CarouselItem className="basis-1/2">Slide 2</CarouselItem>
<CarouselItem className="basis-1/2">Slide 3</CarouselItem>
</CarouselContent>
<CarouselHandler>
<CarouselButton segment="previous" />
<CarouselButton segment="next" />
</CarouselHandler>
</Carousel>Examples
Orientation
You can change the orientation of the carousel by using the orientation prop. The default is horizontal, but you can switch it to vertical.
Options
You want to loop, or align the carouse, don't worry, you can do it with the opts prop.
Autoplay
This a plugin by the embla-carousel it self, it's not included in the package, but you can install it to make sure the carousel autoplay.
npm install embla-carousel-autoplay
Once you install it, you can use it with the plugins prop.
Link
If you need a link in carousel item, it simple, add href to the CarouselItem.
<CarouselItem href="/path/to/page"/>Component API
Carousel
The Carousel component is the root container for carousel state and layout.
| Prop | Type | Default |
|---|---|---|
className | string | - |
opts | CarouselOptions | - |
orientation | "horizontal" | "vertical" | horizontal |
plugins | CarouselPlugin | - |
setApi | (api: CarouselApi) => void | - |
CarouselButton
The CarouselButton component navigates to the previous or next carousel item.
| Prop | Type | Default |
|---|---|---|
className | string | - |
segment | "previous" | "next" | - |
CarouselContent
The CarouselContent component wraps the scrollable carousel track.
| Prop | Type | Default |
|---|---|---|
className | string | - |
CarouselHandler
The CarouselHandler component renders the carousel control area.
| Prop | Type | Default |
|---|---|---|
className | string | - |
CarouselItem
The CarouselItem component wraps one carousel slide.
| Prop | Type | Default |
|---|---|---|
className | string | - |
See the React Aria and Embla Carousel API reference for the full API reference.
Unlock the full power ofIntent UI Design
Build modern web apps faster with 1000+ resources across components, blocks, patterns, templates, and starter kits.






