How it works
The layout is one number: the row's position in cards, a registered CSS property set on the stage. Each card works out its distance d to it in CSS and from that its offset (spacing tightens slightly with distance), a drop that grows with d² (the arc), a tilt of 3.2° and a turn of −7° toward the centre per card, a scale that steps down 15% per card, and a veil in the background colour that deepens with distance; past the visible range cards fade out. Dragging writes the position on every frame. On release the row projects where it would coast at the speed of the throw, picks that card and glides there on the ease-out curve, for longer the further it goes. A grab during a glide catches the row where it is. Past either end the row gives way like a rubber band. Sideways trackpad scrolling moves the row and settles once the fingers stop.
Use it for
- A showcase row on a landing page or a shop: collections, destinations, featured products.
- Browsing a handful of visual items where one at a time deserves attention.
- Onboarding or plan pickers where the centre choice is the one being described.
Look elsewhere when
- Long lists people need to scan or compare: use a grid or a list.
- Content that must all be read: only the centre card is fully visible.
- Text-heavy cards: side cards are small and veiled.
Usage
import { useState } from 'react'
import { ArcCarousel } from './ArcCarousel.jsx'
export function Collections({ collections, openCollection }) {
const [index, setIndex] = useState(0)
return (
<ArcCarousel
items={collections}
index={index}
onIndexChange={setIndex}
label="Collections"
cardWidth={180}
getLabel={(c) => c.name}
renderCard={(c) => <img src={c.cover} alt="" style={{ width: '100%', height: '100%', objectFit: 'cover' }} />}
renderCaption={(c) => (
<>
<strong>{c.name}</strong>
<span>{c.itemCount} pieces</span>
</>
)}
onSelect={(c) => openCollection(c.id)}
/>
)
}Props
| Prop | Type | Default | What it does |
|---|---|---|---|
items | T[] | — | The cards, in order. An `id` on each item is used as its key. |
renderCard | (item, { index, active }) => ReactNode | — | Draws a card's face. It fills the card, which clips it to the rounded corners. |
renderCaption | (item, index) => ReactNode | — | The caption under the centre card; it fades in each time the centre card changes. Defaults to the label. |
getLabel | (item, index) => string | item.title ?? item.name | Accessible name of each card, read with its position ("Salt Bay, 1 of 7"). |
index | number | — | The centre card (controlled). Leave undefined to let the carousel keep its own. |
defaultIndex | number | 0 | The first centre card when uncontrolled. |
onIndexChange | (index, item) => void | — | Called when a drag, swipe, key, trackpad scroll, button or press on a side card chooses a new centre card. |
onSelect | (item, index) => void | — | Called when the centre card is pressed, or on Enter while the carousel has focus. |
cardWidth | number | 168 | Width of the centre card in pixels; the stage height follows. |
cardRatio | number | 1.3 | Card height as a multiple of its width. |
curve | number | 1 | Strength of the arc: how far side cards drop and tilt. 0 is a flat row. |
spread | number | 1 | Spacing between cards as a multiple of the default. |
visible | number | 2 | Cards drawn on each side of the centre before they fade out. |
controls | boolean | true | Shows the previous and next buttons beside the caption. |
label | string | 'Gallery' | Accessible name of the carousel. |
labels | object | — | Replaces built-in text: previous, next, slide(n, total) and hint (read when the stage gets focus). Shallow-merged over the English defaults. |
...rest | HTMLAttributes | — | Other attributes go to the root <section>. |
Accessibility
- The root is a section with aria-roledescription carousel; each card is a group with aria-roledescription slide, named by getLabel plus its position, and the centre one carries aria-current.
- The stage is focusable: Left and Right move one card, Home and End jump to the ends, Enter selects the centre card.
- The caption is a polite live region, so each change is announced with the card's position.
- The previous and next buttons are native buttons with labels and are disabled at the ends.
- On touch the stage keeps vertical scrolling (touch-action: pan-y) and only takes over once a finger moves sideways.
- Reduced motion jumps straight to the chosen card and swaps the caption without moving it; a drag still follows the finger.
Motion
Per card from the centre: scale −15%, tilt 3.2°, turn −7°, drop growing with the square of the distance, veil +26% (all × curve). Glide: ease-out, 520ms for a key or button, 340–900ms after a throw depending on how far it coasts. Caption: rises 6px and fades in over 360ms.
Add it to your project
Pro members copy a prompt and their coding agent installs the source, the same way as the free components.
ArcCarousel.jsxarc-carousel.csstokens.cssREADME.md
Both files install together. The stylesheet reads the design tokens in tokens.css and carries fallbacks, so it also works alone.





