Skip to main content

Carousel

Slides that move left and right, one or a few at a time.

In Multi-brand

See it live​

Start Storybook to see it live: npm run storybook

When to use it​

In Multi-brand: A few items browsed for pleasure on product pages, where missing some is fine. Never for plans or offers; cards group those.

  • Use it when: A few images or items people browse for pleasure, where missing some is fine.
  • Not when: Content people must see: most never reach the later slides.

Instead:

  • Card: A grid shows every item at once.

Words​

  • Shared structure: object, state, next step.
  • Brand tone lives in headlines and marketing copy, not in errors.
  • Errors and confirmations read the same in every brand.
  • Use: Get started, Plan, Order. Avoid: Brand-specific words in errors, Jargon.

The labels components use, from the voice tokens:

  • content.action.commit: Save
  • content.action.cancel: Cancel
  • content.action.destroy: Remove
  • content.action.retry: Try again
  • content.action.empty-action: Get started

See Voice and tone for the whole voice.

Accessibility and keyboard​

KeyboardWhat happensNot
undefinedArrow keys move between slides when the carousel has focus.undefined

Test before you ship:

  • Previous and next are buttons with names; nothing moves on its own without a pause control. undefined

Use it in code​

npx open-ds add carousel

The component reads only component keys and semantic tokens, so it follows the brand and mode on <html>.

Tokens it reads​

Carousel reads 6 tokens of its own, each an alias of a semantic token. Each row is one part: its own token, the semantic it aliases, and the value it ends at. Change a semantic and every component that reads it follows; override one of Carousel's tokens to change Carousel alone.

Changes with theme

Multi-brand decides what changes when you switch theme. Here a switch changes colors, type and shape, so the marked rows differ between its brands and between light and dark; everything else holds steady.

PartIts token and the semantic it aliasesValue
Item
Padding leftcomponent.carousel.item.padding-leftcomponent-spacing-map.x4var(--carousel-item-padding-left)space.24:1.5rem
Padding, topcomponent.carousel.item.padding-topcomponent-spacing-map.x4var(--carousel-item-padding-top)space.24:1.5rem
Previous
Sizecomponent.carousel.previous.sizesize.control.defaultvar(--carousel-previous-size)size.44:2.75rem
Cornercomponent.carousel.previous.radiusradius.roundvar(--carousel-previous-radius)radius.full:9999px
Next
Sizecomponent.carousel.next.sizesize.control.defaultvar(--carousel-next-size)size.44:2.75rem
Cornercomponent.carousel.next.radiusradius.roundvar(--carousel-next-radius)radius.full:9999px