# Carousel

A React component in [Beamline](https://beamline.io/)'s [Layout](https://beamline.io/components/layout) category. Live demo: https://beamline.io/components/carousel

A row of slides that snap into place: swipe on touch, drag or the arrows with a mouse, ← → when focused, or the dots; optional autoplay that pauses and has a pause button.

## Use it for

- Browsing a few visual items one at a time: images, templates, release highlights.

## Not for

- Content people must see (show it in a grid).
- Data tables.

## Anatomy

- track (focusable, the look's focus ring)
- slide (non-current slides under a page-colour veil)
- dots (current = bar; fills over the interval while autoplay runs)
- pause/play (ghost Button, autoplay only)
- previous / next (secondary Buttons)

## States

- current slide
- neighbour (veiled, inert)
- autoplay running (current dot fills)
- held (pointer or focus inside: timer and fill stop)
- paused
- reduced motion (no autoplay, no smooth scroll, no fill)

## Keyboard

- ← → move when focused
- Tab reaches the dots and buttons

## Motion

The browser scrolls smoothly to the next slide; the veil on non-current slides fades over --pui-motion-out; while autoplay runs the current dot fills linearly over interval and restarts with the timer. Reduced motion: instant scroll, no autoplay, no fill.

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `label` | `string` | — |  |
| `index / defaultIndex / onIndexChange` | `number` | — |  |
| `slideSize` | `string` | `"100%"` |  |
| `autoplay / interval` | `boolean / number` | `false / 5000` |  |
| `slideLabel` | `(index, count) => string` | — |  |
| `style / ref` | `CSSProperties / native Ref` | — |  |
| `classNames` | `CarouselClassNames` | — |  |

## Dependencies

`lucide-react`, `motion`

## Import

```tsx
import { Carousel } from "@/components/carousel/carousel";
```

## Get it

Carousel is part of Beamline: 190 React components and screens your coding agent (Claude Code, Codex, Cursor or any MCP client) installs into your app through Beamline's MCP server, as a ready-built package or as plain React source you can change. $49 one payment (regular $200), no subscription, a year of updates, one licence for your whole team. [Get Beamline](https://beamline.io/checkout?pack=complete) · [Connect your agent](https://beamline.io/connect)

## More in Layout

- [Accordion](https://beamline.io/components/accordion): Topics that open in place, one at a time or several: FAQs and settings sections; each header is a button and the panel's height follows its content.
- [Aspect ratio](https://beamline.io/components/aspect-ratio): Holds media, video and embeds at a fixed width-to-height ratio while the layout resizes.
- [Bezel](https://beamline.io/components/bezel): A double-bezel frame: an outer shell with a hairline, a small gap, and an inset panel with its own edge, so a preview, chart or media reads as set into…
- [Card](https://beamline.io/components/card): A record or a small group of related content and actions: optional media, avatar, title, status, action, meta, free content and a Details toggle; plain…
- [Collapsible](https://beamline.io/components/collapsible): One region that opens and closes in place from its trigger, its height animating to the content.
- [Direction](https://beamline.io/components/direction): Sets left-to-right or right-to-left for everything inside: text and logical spacing flip, and Radix parts read the direction for keys and placement.
- [Expandable card](https://beamline.io/components/expandable-card): A dense card that grows in place when asked: the frame resizes and the clamped preview opens into the full text.
- [Resizable panels](https://beamline.io/components/resizable-panels): Panes that trade space across draggable dividers; each divider is a focusable separator with arrow keys, limits, folding for collapsible panes and…
- [Scroll area](https://beamline.io/components/scroll-area): A native scroll region with thin overlay thumbs and edge fades that show only where more content waits; thumbs can be dragged or clicked.
- [Separator](https://beamline.io/components/separator): A hairline between groups, horizontal or vertical; hidden from screen readers unless it carries meaning.
- [UI root](https://beamline.io/components/ui-root): Makes a region of any app a Beamline root: theme, brand and direction for everything inside, and a matching layer at page level where its menus, dialogs…
