Theme studio

Design a theme, preview it live, then export it. Saved in this browser.

Quick picks #10b981
Generated scale
50100200300400500600700800900
Some text is below AA

CarouselControls

  • Stable
  • WCAG 2.2 evidence
  • RTL

Previous / Next buttons for a carousel, and optionally a button that stops and starts automatic rotation. There is no carousel engine: you render the slides and show the one at index; these controls only move the index and the rotation state. Built on React Aria Buttons in a group: Enter and Space press them, keyboard focus shows the focus ring, and every button is a 40 px target (WCAG 2.1.1, 2.4.7, 2.5.8, 4.1.2). Without isLooping the ends are aria-disabled rather than disabled, so focus stays on the button that reached the end. The chevrons mirror in right-to-left layouts (Previous points right); the play / pause glyphs do not. The rotation button changes its name and icon ("Stop automatic slide show" / "Start automatic slide show") instead of using aria-pressed. Consumer duties (APG carousel pattern): put the controls before the slides in a region or group with aria-roledescription="carousel" and a name; label each slide ("3 of 5"); make the slide container aria-live="polite" while not rotating ("off" while rotating); stop rotation while keyboard focus or the pointer is in the carousel and do not start it when the user prefers reduced motion (2.2.2); translate the labels.

import { CarouselControls } from "@nexera-ui/react";
Loading example…
5
examples
15
props
5
live controls
1
platform
9
WCAG criteria
1
block uses it

Try every prop. Copy the code.

Change the props and the code updates. Check light and dark, LTR and RTL, and phone width.

Loading…
surface
isLooping
isPlaying
defaultPlaying
isDisabled
Generated code
import { CarouselControls } from "@nexera-ui/react";

<CarouselControls />

Examples 4

The same examples as Storybook, rendered live. Open Code to copy one.

Arrows and play

Type=Arrows and play: the rotation button stops and starts automatic rotation (WCAG 2.2.2).

Loading example…

On media

Surface=On media: white buttons with a shadow, over a picture.

Loading example…

Looping

isLooping: Next on the last slide goes back to the first, so no end is disabled.

Loading example…

Carousel recipe

Recipe (no carousel engine ships): the APG carousel pattern composed from CarouselControls, CarouselIndicator and your slides. The region is named and described as a carousel, the controls come first, the slide container is aria-live="polite" while not rotating, rotation stops while the pointer or keyboard focus is inside, and it never starts when the user prefers reduced motion.

Loading example…

Props 15

Press "Try it" on a card to load that prop into the playground.

15 props shown

typeNexera
"arrows" | "arrows-and-play"

Buttons shown: arrows (Previous, Next) or arrows-and-play (plus a button that stops and starts automatic rotation; required whenever slides rotate on their own, WCAG 2.2.2).

Default arrows
surfaceNexera
"on-light" | "on-media"

Background the controls sit on: on-light (outlined surface buttons) or on-media (white buttons with a shadow, over a picture).

Default on-light
count*Nexera
number

Number of slides. With isLooping off, Previous is unavailable on the first slide and Next on the last.

Default –
indexNexera
number

Index of the current slide, from 0 (controlled). Pair it with onIndexChange.

Default –
defaultIndexNexera
number

Index of the current slide at first render (uncontrolled).

Default 0
onIndexChangeNexera
(index: number) => void

Called with the new slide index when Previous or Next is pressed. Show that slide.

Default –
isLoopingNexera
boolean

Wrap around: Next on the last slide goes to the first, Previous on the first goes to the last. Without it the ends are aria-disabled (the button keeps focus, presses do nothing).

Default false
isPlayingNexera
boolean

Whether the slides rotate automatically (controlled), shown by the rotation button: Figma Pause while rotating, a play icon otherwise. Pair it with onPlayingChange; the library has no timer, you run the rotation.

Default –
defaultPlayingNexera
boolean

Rotation state at first render (uncontrolled). The Figma Arrows and play variant shows Pause, so the default is rotating; pass false when the user prefers reduced motion.

Default true
onPlayingChangeNexera
(isPlaying: boolean) => void

Called with the new rotation state when the rotation button is pressed. Stop or start your timer.

Default –
slidesIdNexera
string

Id of the element that holds the slides; set as aria-controls on the buttons.

Default –
isDisabledNexera
boolean

Disables every button (skipped by Tab).

Default false
labelsNexera
Partial<CarouselControlsLabels>

Accessible names of the buttons; English defaults. Translate them.

Default –
classNameNexera
string

Extra classes for the root, merged last so they win over the defaults.

Default –
styleNexera
CSSProperties

Inline style for the root.

Default –

* Required. React Aria props shown are the ones most apps use; the component accepts the rest of its React Aria props too.

Accessible by default.

Built on React Aria, and covered by the WCAG 2.2 evidence generated on every build.

WCAG 2.2 evidence

6 direct · 3 supporting
  • 1.3.1Info and RelationshipsLevel A · tested directly
  • 1.3.2Meaningful SequenceLevel A · supporting test
  • 1.4.11Non-text ContrastLevel AA · supporting test
  • 2.1.1KeyboardLevel A · tested directly
  • 2.2.2Pause, Stop, HideLevel A · tested directly
  • 2.4.3Focus OrderLevel A · tested directly
  • 2.4.7Focus VisibleLevel AA · tested directly
  • 2.5.8Target Size (Minimum)Level AA · supporting test
  • 4.1.2Name, Role, ValueLevel A · tested directly

Fits any width.

Nexera components respond to the space they are given. Drag the corner of the frame, or pick a width.

0 px · drag the corner

Styling hooks

Pass className to add Tailwind classes (merged last). State is exposed as data attributes, so you can style it with variants like data-pressed:.

  • data-disabled
  • data-hovered
  • data-pressed
Usage
<CarouselControls className="data-disabled:opacity-90 shadow-sm" />

Used in blocks

Related components