Skip to content
English
Ribbon ring comes with Pro. Its preview shows once you unlock it.

How it works

A preserve-3d ring tipped toward the viewer, rolled a little and turned by one angle in degrees. Each slim card stands on the ring at its own place and is then turned about its own upright by the fan angle, so neighbours overlap like the pages of a fanned ribbon; with more places than items the items repeat. In CSS each card takes the cosine of the way it faces and brightens toward the front. Pointing at a card lifts it out of the ribbon; the card in front is lifted too and takes an accent rim. Pressing a card turns it to the front by the shortest way round; pressing the front card, double-clicking any card, Enter or the name under the ring opens it: the ring dims and blurs behind, and the card rises large and flat over it. Escape, the close button or the name lays it back. One frame loop handles the tweens, the coast after a throw and the slow drift.

Use it for

  • A showcase of many small, mostly visual items on a landing page or a portfolio: swatches, covers, screens, tickets.
  • Twenty or more places; with a short list, set slots so the items repeat and the ribbon looks full.

Look elsewhere when

  • Not for text people must read in the ribbon: the cards are slim and turned; put the words in the open card.

Usage

import { RibbonRing } from './RibbonRing.jsx'

const swatches = [
  { id: 'slate', name: 'Mineral Slate', hex: '#5B6770' },
  { id: 'linen', name: 'Warm Linen', hex: '#E9DFCF' },
  { id: 'moss', name: 'Forest Moss', hex: '#4F6B3A' },
  { id: 'terracotta', name: 'Terracotta', hex: '#C4623F' },
]

export function Swatches() {
  return (
    <RibbonRing
      items={swatches}
      slots={24}
      label="Material swatches"
      renderCard={(s) => <div style={{ height: '60%', background: s.hex }} />}
      renderDetail={(s) => (
        <div style={{ height: '100%', display: 'grid', gridTemplateRows: '1fr auto' }}>
          <div style={{ background: s.hex }} />
          <strong style={{ padding: 14 }}>{s.name}</strong>
        </div>
      )}
    />
  )
}

Props

PropTypeDefaultWhat it does
itemsT[][]The cards, in order round the ring.
renderCard(item, { index, front }) => ReactNode—Content of a slim card in the ribbon. Keep it graphic: a colour, a picture, two lines.
renderDetail(item, { index }) => ReactNode—Content of the open card, shown large over the ring. Falls back to renderCard.
getLabel(item, index) => string—Name of each card, shown under the ring and read by screen readers. Defaults to item.title or item.name.
indexnumber—Controlled current card. Omit to let the ring keep its own.
defaultIndexnumber0First current card for an uncontrolled ring.
onIndexChange(index, item) => void—Called when another card comes to the front.
openboolean—Controlled open state of the current card. Omit to let the ring keep its own.
defaultOpenbooleanfalseInitial open state for an uncontrolled ring.
onOpenChange(open: boolean) => void—Called when a press, a double-click, Enter, Escape or the close button asks to open or close the current card.
slotsnumber0Places round the ring. When larger than the number of items the items repeat (copies are hidden from screen readers); a ribbon needs about 20 or more.
cardWidthnumber70Width of a slim card in pixels.
cardRationumber1.45Card height over width.
radiusnumber170Radius of the ring in pixels. The scene scales down to fit narrow containers.
fannumber62How far each card turns about its own upright, in degrees: 0 faces out like a cylinder, near 90 stands edge-on like the pages of a book.
tiltnumber20How far the ring is tipped toward the viewer, in degrees.
rollnumber-14Sideways roll of the whole ring, in degrees.
autoSpinbooleantrueDrift slowly on its own. It stops while the ring is pointed at, focused or open, adds a pause button and never runs under reduced motion.
speednumber7Drift speed in degrees per second.
pausedbooleanfalseHolds the drift from outside.
controlsbooleantrueShow previous and next, the current card's name (a button that opens it) and the pause button under the ring.
labelstring'Collection'Accessible name of the carousel.
labels{ previous?, next?, open?, close?, pause?, play?, slide?, hint? }—Replaces the built-in English text; slide is a function of (n, total).

Accessibility

  • The section is a carousel (aria-roledescription) and each original card a slide named by its label and position; repeated copies are aria-hidden.
  • The ring is one focusable stop: Left and Right bring the previous or next card to the front, Home and End the ends, Enter or Space opens the current card.
  • Opening moves focus to the close button and makes the ring inert; Escape or the close button closes it and returns focus to the ring. The name under the ring is a button with aria-expanded that does the same for pointers and touch.
  • The drift stops while the ring is pointed at, focused or open, and the pause button stops it for good (aria-pressed). A polite live region names the current card except while the ring drifts.
  • A finger must move sideways before the ring turns, so a vertical page scroll that starts on it still works; on touch a tap turns a card to the front and a second tap opens it.
  • Under reduced motion there is no drift and no coasting: the ring steps straight to the chosen card, and the open card appears in place without rising.

Motion

A chosen card turns to the front in 680 ms on an ease-out cubic; a throw coasts with friction and settles in 420 ms; the drift resumes 0.9 s after the last touch. A card lifts in 240 ms; the open card rises in 360 ms while the ring dims. Under reduced motion every change is immediate.

Add it to your project

Pro members copy a prompt and their coding agent installs the source, the same way as the free components.

RibbonRing.jsxribbon-ring.csstokens.cssREADME.md

Both files install together. The stylesheet reads the design tokens in tokens.css and carries fallbacks, so it also works alone.

Lists & layout
Arc carousel comes with Pro. Its preview shows once you unlock it.
Cylinder carousel comes with Pro. Its preview shows once you unlock it.