Skip to content
THE COMPONENT LIBRARY
Skip to content

Component reference

MultiCarousel

Several cards per view on one shared scroll-snap track.

Preview

Live preview

Changes apply to this preview only.

Width adapts to the available space

More examples

Different configurations and compositions using the real Pimolu API. Each preview runs independently and follows the site appearance.

The page owns the active index and receives every arrow, dot and keyboard change.

Open preview

Two cards per view with previous, next, pagination and slide labels in French.

Open preview

A narrower composition for comparison pages and compact sidebars.

Open preview

Apply local classes to the track, cards, controls and dots without replacing the built-in scroll-snap or focus states.

Open preview

Try 3 or 4 columns, then filter to one or two products. Cards keep their column width and centre when they fit; dots return when the track can scroll. This example also hides the arrows below 640px using showControlsOnMobile.

Open preview

Usage

MultiCarousel shows slidesPerView cards at once. Use CarouselContent, CarouselSlide and the shared controls for paging.

The track keeps one active index while several cards remain visible. gap controls the space between cards; loop wraps the page navigation.

In the current workspace, a product rail with slidesPerView={3} or {4} keeps each card at its column width on wide screens, even after a filter leaves only one or two products. The cards centre as a group when they fit.

Arrows and pagination appear only when the rail has a reachable second page. They update when the container resizes or products are added or removed, and the active page resets to the nearest valid page when the current one disappears. Remove any local flex-grow workaround after upgrading to a release that includes this fix.

slideAppearance="plain" removes the built-in slide border, background and clipping when each application card owns its frame and hover transform. showControlsOnMobile={false} hides the arrows below 640px; swipe, dots and the keyboard remain.

Available since 0.1.0-beta.9: the carousel families install from the published packages.

API reference

Generated from the public TypeScript declarations. Native HTML attributes are inherited where the component extends them; this reference includes Pimolu props and selected common native attributes.

MultiCarouselProps

Type source
MultiCarouselProps public API
NameTypeDefaultDescription
childrenRequiredReactNode—Slides: wrap each one in CarouselSlide.
loopbooleanfalseWraps from the last slide to the first one. Defaults to false.
indexnumber—Controlled active index (zero-based).
defaultIndexnumber0Initial index when uncontrolled. Defaults to 0.
onIndexChange((index: number) => void)—Called with the new index when navigation changes it.
labelsPartial<CarouselLabels>—Overrides the built-in accessible labels.
gapnumber16Space between slides in pixels.
classNamesCarouselStageClassNames—Additive classes for the stable named parts. Named parts are listed in the Class names table.
slidesPerViewnumber1Preferred number of slides visible at once. Narrow layouts keep a readable card width and may show fewer. Cards retain their width when the rail contains fewer slides. Defaults to 1.
slideAppearance"plain" | "surface""surface""surface" draws the slide frame around each card. "plain" removes that border, background and clipping so an application card can own its own frame and hover transform. Defaults to "surface".
defaultValuestring | number | readonly string[]—Standard React/HTML attribute.
classNamestring—Standard React/HTML attribute.
styleCSSProperties—Standard React/HTML attribute.
aria-labelstring—Defines a string value that labels the current element.
onClickMouseEventHandler<HTMLDivElement>—Standard React/HTML attribute.
showControlsOnMobilebooleantrueShows the previous/next controls on narrow viewports. Defaults to true. Swiping remains available when they are hidden.
childrenRequired

ReactNode

No default extracted.

Slides: wrap each one in CarouselSlide.

loop

boolean

Default: false

Wraps from the last slide to the first one. Defaults to false.

index

number

No default extracted.

Controlled active index (zero-based).

defaultIndex

number

Default: 0

Initial index when uncontrolled. Defaults to 0.

onIndexChange

((index: number) => void)

No default extracted.

Called with the new index when navigation changes it.

labels

Partial<CarouselLabels>

No default extracted.

Overrides the built-in accessible labels.

gap

number

Default: 16

Space between slides in pixels.

classNames

CarouselStageClassNames

No default extracted.

Additive classes for the stable named parts. Named parts are listed in the Class names table.

slidesPerView

number

Default: 1

Preferred number of slides visible at once. Narrow layouts keep a readable card width and may show fewer. Cards retain their width when the rail contains fewer slides. Defaults to 1.

slideAppearance

"plain" | "surface"

Default: "surface"

"surface" draws the slide frame around each card. "plain" removes that border, background and clipping so an application card can own its own frame and hover transform. Defaults to "surface".

defaultValue

string | number | readonly string[]

No default extracted.

Standard React/HTML attribute.

className

string

No default extracted.

Standard React/HTML attribute.

style

CSSProperties

No default extracted.

Standard React/HTML attribute.

aria-label

string

No default extracted.

Defines a string value that labels the current element.

onClick

MouseEventHandler<HTMLDivElement>

No default extracted.

Standard React/HTML attribute.

showControlsOnMobile

boolean

Default: true

Shows the previous/next controls on narrow viewports. Defaults to true. Swiping remains available when they are hidden.

Class names

7 parts

Pass these keys to classNames to style the matching element. A part renders only when its element or state is present; keys are additive and never replace the component class.

  • dots
  • live
  • next
  • previous
  • root
  • slide
  • viewport

CSS variables

18 variables

Custom properties read by this component's shared stylesheet. Set them on the component, an ancestor or :root; they fall back to the theme when unset.

  • --pimolu-background
  • --pimolu-border
  • --pimolu-carousel-controls-center
  • --pimolu-carousel-gap
  • --pimolu-carousel-per-view
  • --pimolu-control-background
  • --pimolu-control-foreground
  • --pimolu-focus-ring
  • --pimolu-font-body
  • --pimolu-foreground
  • --pimolu-muted
  • --pimolu-primary
  • --pimolu-radius-full
  • --pimolu-radius-lg
  • --pimolu-radius-sm
  • --pimolu-shadow-raised
  • --pimolu-spacing-2
  • --pimolu-surface

Accessibility

  • Verify that the visible page, dots and previous/next controls describe the same selection at every viewport width.
  • Focus the viewport to use the arrow keys, Home and End. When resizing removes a focused navigation button, focus moves to the viewport.
Read the accessibility guide →