Skip to content
THE COMPONENT LIBRARY
Skip to content

Component reference

ThumbnailCarousel

A main stage with a thumbnail rail that shares one active index.

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 rail, arrow and keyboard change.

Open preview

Previous, next, pagination and slide labels can follow the application language.

Open preview

A smaller stage that keeps the thumbnail rail visible with five captioned images.

Open preview

Apply local classes to the stage, controls and thumbnail rail without replacing the built-in selection, focus or disabled states.

Open preview

The thumbnail image has its own named part and a 1:1 default crop, so mixed source ratios no longer produce a saw-tooth rail. classNames.thumbnailImage targets the image itself.

Open preview

Usage

Compose ThumbnailCarousel with CarouselContent, CarouselSlide, CarouselPrevious, CarouselNext, CarouselThumbnails and CarouselThumbnail. The rail and the arrow keys use the same engine state.

Pass loop, index/defaultIndex and onIndexChange like the other families. gap controls the slide spacing; the thumbnail rail keeps its own compact spacing.

Thumbnail images use a 1 / 1 crop by default, adjustable with --pimolu-carousel-thumbnail-aspect-ratio, so mixed source ratios keep a uniform rail. classNames.thumbnailImage targets the image; classNames.thumbnail remains the button.

In the current workspace, a single image renders without arrows or a thumbnail rail.

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.

ThumbnailCarouselProps

Type source
ThumbnailCarouselProps 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.
gapnumber12Space between slides in pixels.
classNamesPartial<Record<CarouselPartNames, string>>—Additive classes for the stable named parts. Named parts are listed in the Class names table.
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: 12

Space between slides in pixels.

classNames

Partial<Record<CarouselPartNames, string>>

No default extracted.

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

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

10 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
  • thumbnail
  • thumbnailImage
  • thumbnails
  • 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-carousel-thumbnail-aspect-ratio
  • --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

Accessibility

  • Every thumbnail is a real button with aria-current, so pointer and keyboard users can switch the collection.
  • Verify previous/next, the rail selection and the live region; images need a meaningful alt in the thumbnail rail.
Read the accessibility guide →