Weftv0.4.0
GitHubFigma
Blade AI
Display · Carouselstable

Carousel

Steps through a row of slides with previous and next arrows and indicators. One or two slides visible, arrows below or beside the slides, and a peek of the next slide on mobile.

Preview

#preview

Change the options and the code follows. Show code opens the React snippet.

carousel-example.tsx
import { Carousel } from "@blade-ai/weft/components/carousel";

<Carousel accessibilityLabel="Highlights">
  <Slide>Instant settlements</Slide>
  <Slide>UPI AutoPay</Slide>
  <Slide>Payment links</Slide>
</Carousel>

All states

#all-states

Arrow states and the visible items and navigation position layouts, from the Carousel artboard.

Carousel · position layouts · arrow states
1 item · Bottom
1 item · Side
2 items · Bottom
2 items · Side
Arrow · Hover
Arrow · Focus
Mobile · peek

Props

#props

Read from the component source. Booleans are is-prefixed. A star marks a required prop.

Prop
Type
Default
Description
children *
ReactNode
—
One child per slide.
visibleItems
1 | 2
1
Slides visible at once.
navPosition
"bottom" | "side"
"bottom"
"bottom" puts arrows and indicators in a row under the slides; "side" puts arrows beside them.
isPeek
boolean
false
Shows the next slide's edge so it reads as scrollable (mobile). Single-item only.
accessibilityLabel *
string
—
Accessible name of the carousel region.
onIndexChange
(index: number) => void
—
Fires when the first visible slide changes.

Usage

#usage

Short rules for choosing and writing carousel.

Do
Use a carousel for a small set of parallel, optional content such as feature highlights.
Keep slides the same shape and a similar amount of content.
Use the peek on mobile so the row reads as scrollable.
Don't
Hide essential content or the only path to a task in later slides.
Auto-advance slides.
Use more than about six slides.

Accessibility

#accessibility

A labelled carousel region. Slides are announced as "n of m" and the arrows are buttons.

Keyboard
Key
Action
Tab / Shift+Tab
Moves between the arrows and the indicators.
Enter / Space
Activates the focused arrow or indicator.
ARIA
Element
Role / attribute
When
Carousel
role="region" · aria-roledescription="carousel" · aria-label
Set accessibilityLabel.
Slide
role="group" · aria-label "n of m"
Each child.
Arrows
button · aria-label Previous / Next
Disabled at the ends.