---
title: "Carousel"
description: "Photos, cards, or quotes that people move through one at a time, with arrows, dots, and a count. It works right to left."
url: https://gelatinui.com/components/carousel
markdown_url: https://gelatinui.com/components/carousel.md
access: free
install: "npx shadcn@latest add @gelatin-ui/carousel"
registry_item: https://gelatinui.com/r/carousel.json
version: "2026-11-08"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Carousel

> Photos, cards, or quotes that people move through one at a time, with arrows, dots, and a count. It works right to left.

Page: https://gelatinui.com/components/carousel

## When to use it

Best for: A set of slides that people move through one at a time: photos, cards, or quotes.

- Use it for a set of slides that people move through one at a time: photos, cards, quotes.
- Always give it a name with `aria-label` ("Trip photos"), so screen readers list it as a region.
- At a phone width, use `position="inside"` or `"static"` for the buttons. The default `outside` buttons need 48px of room on each side.

## When not to use it

- To show every item at once, use a grid of cards.
- For one picture, use an [Image](https://gelatinui.com/components/image.md).

## Notes for agents

- It runs on Embla: pass Embla options in `opts`, such as `{ loop: true }`.
- Give each `CarouselItem` a `basis-*` class to show several slides at once.
- Translate `slideLabel` and the `aria-label` of the buttons.

## Anatomy

```text
Carousel
├─ CarouselContent (0..n)
├─ CarouselItem (0..n)
├─ CarouselPrevious (0..n)
├─ CarouselNext (0..n)
├─ CarouselDots (0..n)
└─ CarouselCounter (0..n)
```

## API reference

### Carousel

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `opts` | `Partial<OptionsType>` |  | Embla options (`loop`, `align`, `slidesToScroll`, `dragFree`, `startIndex`, `breakpoints`). |
| `plugins` | `CreatePluginType<LoosePluginType, {}>[]` |  | Embla plugins (autoplay, auto height, class names, wheel gestures). |
| `orientation` | `"horizontal" \| "vertical"` | "horizontal" |  |
| `setApi` | `function` |  | Gets the Embla API once it starts, for your own controls and events. |
| `slideLabel` | `function` | defaultSlideLabel | The name of each slide for screen readers. Translate it. Default: "2 of 5". |
| `statusLabel` | `function` | defaultStatusLabel | The name of each dot. Translate it. Default: "Slide 2 of 5". |
| `labels` | `Partial<typeof CAROUSEL_LABELS>` |  | The words of the parts (`CAROUSEL_LABELS`). Keep the object stable. |

### CarouselContent

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### CarouselItem

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### CarouselPrevious

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `rounded` | `"default" \| "full"` | "full" |  |
| `size` | `"default" \| "icon" \| "icon-lg" \| "icon-sm" \| "icon-xs" \| "lg" \| "sm" \| "xl" \| "xs"` | "icon" |  |
| `position` | `"inside" \| "outside" \| "static"` |  |  |
| `className` | `string` |  |  |
| `variant` | `NonNullable` | "outline" | A Button variant, or `dark`, `light`, `clear` (the Button `media` glass) on a picture. |

Also takes every prop of Base UI `Button`: https://base-ui.com/react/components/button

### CarouselNext

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `rounded` | `"default" \| "full"` | "full" |  |
| `size` | `"default" \| "icon" \| "icon-lg" \| "icon-sm" \| "icon-xs" \| "lg" \| "sm" \| "xl" \| "xs"` | "icon" |  |
| `position` | `"inside" \| "outside" \| "static"` |  |  |
| `className` | `string` |  |  |
| `variant` | `NonNullable` | "outline" | A Button variant, or `dark`, `light`, `clear` (the Button `media` glass) on a picture. |

Also takes every prop of Base UI `Button`: https://base-ui.com/react/components/button

### CarouselDots

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `variant` | `"default" \| "overlay"` |  |  |
| `getLabel` | `function` |  | The name of each dot. Default: the `Carousel` `statusLabel` ("Slide 2 of 5"). |

### CarouselCounter

No props of its own: `className`, `children`, and every other prop go to the element it renders.

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| Carousel | `carousel` |  |  |  |
| CarouselContent | `carousel-content` |  |  |  |
| CarouselItem | `carousel-item` |  |  |  |
| CarouselPrevious | `carousel-previous` | `data-orientation` |  |  |
| CarouselNext | `carousel-next` | `data-orientation` |  |  |
| CarouselDots | `carousel-dots` | `aria-current`, `data-disabled`, `data-orientation` |  | `motion-timing` |
| CarouselCounter | `carousel-counter` |  |  |  |

## Usage

Name the carousel with `aria-label`. Give each `CarouselItem` a `basis-*` class to show several slides at once.

```tsx title="trip-photos.tsx"
import { Carousel, CarouselContent, CarouselDots, CarouselItem, CarouselNext, CarouselPrevious } from "@/components/ui/carousel";

type Photo = { src: string; alt: string };

export function TripPhotos({ photos }: { photos: Photo[] }) {
  return (
    <Carousel aria-label="Trip photos" opts={{ loop: true }} className="w-full max-w-md">
      <CarouselContent>
        {photos.map((photo) => {
          return (
            <CarouselItem key={photo.src}>
              <img src={photo.src} alt={photo.alt} className="aspect-video w-full rounded-lg object-cover" />
            </CarouselItem>
          );
        })}
      </CarouselContent>
      <CarouselPrevious position="inside" />
      <CarouselNext position="inside" />
      <CarouselDots className="mt-2 justify-center" />
    </Carousel>
  );
}
```

## Compose

Rules:

- Group with a Frame (`group-in-frames`): Put related panels in one `Frame` with its header and footer outside the panels, and keep a plain `Card` for one block of content.
- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

```bash
npx shadcn@latest add @gelatin-ui/carousel
```

It adds 15 registry items: 12 files, 2355 lines, and the npm packages `@base-ui/react`, `@mantine/hooks`, `@phosphor-icons/react`, `clsx`, `embla-carousel`, `embla-carousel-react`, `tailwind-merge`, `tailwind-variants`.

## Built on

- [Button](https://gelatinui.com/components/button.md)

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Image](https://gelatinui.com/components/image.md)
- [Card](https://gelatinui.com/components/card.md)

## Keyboard

| Keys | Action |
| --- | --- |
| → | Moves to the next stop when the focus is in the carousel. In right to left, it moves to the previous stop. |
| ← | Moves to the previous stop. In right to left, it moves to the next stop. |
| ↓ | Moves to the next stop in a vertical carousel. |
| ↑ | Moves to the previous stop in a vertical carousel. |
| Tab | Moves the focus to Previous, Next, the dots, and the links in the slides. |

## Accessibility

The carousel is a `<section>` with `aria-roledescription="carousel"`. Name it with `aria-label` or `aria-labelledby`: a section with no name is not a region. In development it warns once.

Each slide is a `<fieldset>` (role `group`) with `aria-roledescription="slide"`, named "2 of 5" by `slideLabel`. A slide with its own `aria-label` keeps it.

Translate `slideLabel` and the names of the buttons (`aria-label`).

Previous and Next keep keyboard focus when they disable at an end (`aria-disabled`), so the arrow keys keep working. Their touch target is 44px. The dots are 24px buttons, 44px high on touch, and the current dot has `aria-current`.

The arrow keys do nothing in a text field in a slide, so they move the text cursor there.

## Motion

| Part | Motion |
| --- | --- |
| Slide move | embla · `duration` 25 (the Embla default) · a drag follows the pointer and settles on a stop |
| Press | press · 100ms · ease-out (0, 0, 0.2, 1) · Previous and Next move down 1px |
