Carousel

A React component in Beamline's Layout category, in the free sample.

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; fold into a "3 / 12" count when they would crowd the controls)
  • pause/play (ghost Button, autoplay only)
  • previous / next (secondary Buttons)

States

  • Direction follows the nearest scope: RTL pages align multi-slide rows at the right, and buttons, arrow keys and mouse drag move along that row. An LTR island inside RTL keeps its autoplay fill left to right.
  • current slide
  • several in view (minSlideWidth: the slides in view are live, the rest veiled)
  • neighbour (veiled, inert)
  • autoplay running (current dot fills)
  • held (pointer over it, keyboard focus inside, or on touch a tap until the next tap: timer and fill stop)
  • paused
  • reduced motion (no autoplay, no smooth scroll, no fill)

Keyboard

  • ← → move when focused (they follow the reading direction)
  • Home / End go to the first and last
  • 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

PropTypeDefaultDescription
labelstring—What the slides are, e.g. "Destinations".
index / defaultIndex / onIndexChangenumber—
slideSizestring"100%"Width of a slide as a CSS length; under 100% the next slide peeks. Default "100%".
minSlideWidthnumber—Show as many slides side by side as fit at this width (px): more room shows more, and each step moves one slide. Takes over from slideSize.
autoplay / intervalboolean / numberfalse / 5000
slideLabel(index, count) => string—The name each slide is read with. Default "3 of 6".
style / refCSSProperties / native Ref—style: Inline styles on the documented visual root; no overrides by default. ref: Receives the documented native target or imperative handle; omitted by default.
classNamesCarouselClassNames—Classes for the named visual parts; no overrides by default.
children (required)ReactNode—One child per slide.
indexnumber—
defaultIndexnumber—
onIndexChange((index: number) => void)—
autoplayboolean—Moves on by itself every `interval` ms; held by hover, keyboard focus or a tap, still with reduced motion, and has a pause button.
intervalnumber—
styleCSSProperties—Inline styles on the documented visual root; no overrides by default.
refRef<HTMLElement>—Receives the documented native target or imperative handle; omitted by default.
classNamestring—Classes on the documented visual root; no override by default.

Built from

Dependencies

lucide-react, motion

Import

import { Carousel } from "@beamline/carousel";

Get it

Carousel is part of Beamline UI. Install the parts you need in your React app as compiled packages or editable source. Carousel is included in the free MIT sample. Get Beamline · Connect your agent

More in Layout

  • 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: 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…
  • Resizable panels: Panes that trade space across draggable dividers; each divider is a focusable separator with arrow keys, limits, folding for collapsible panes and…
  • 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…
  • Expandable card: A dense card that grows in place when asked: the frame resizes and the clamped preview opens into the full text.
  • Accordion: Topics that open in place, one at a time or several: FAQs and settings sections; each header is a button (with an optional fact at its end), and the…
  • Collapsible: One region that opens and closes in place from its trigger, its height animating to the content.
  • 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.
  • Aspect ratio: Holds media, video and embeds at a fixed width-to-height ratio while the layout resizes.
  • 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.
  • Separator: A hairline between groups, horizontal or vertical; hidden from screen readers unless it carries meaning.

Part of Beamline UI: polished, editable React components and complete screens for custom applications. Build your own style from any look; tokens, fonts, radii, motion; not only colours.