Skip to content
THE COMPONENT LIBRARY
Skip to content

Component reference

TiltedCarousel

A horizontal rail of separated, slightly tilted cards with optional continuous scroll.

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

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

Open preview

Play the decorative service ticker in either direction. Its own pause button returns to manual navigation. Hover and focus pause motion temporarily, and reduced motion keeps the rail manual.

Open preview

Set a responsive card width and a track height, then apply local classes to the cards, controls and dots.

Open preview

Usage

TiltedCarousel keeps a scroll-snap rail with visible gaps between cards. Use CarouselContent, CarouselSlide and the shared controls; the viewport is focusable and the arrow keys mirror RTL.

Use tilt={0} for straight cards and gap for spacing in pixels. slidesPerView is a target count and keeps a readable minimum card width. Use slideWidth to set your own responsive CSS length, and viewportHeight for the height of the track.

Use autoScroll for decorative cards. The rail stays manual if cards contain common interactive elements or explicit HTML IDs. Extra copies are visual only and hidden from assistive technology. autoScrollDirection sets the physical direction and speed sets pixels per second.

The automatic rail runs only when its cards overflow. It pauses on hover or focus. Its built-in button returns to manual navigation while paused; customize it with pauseLabel, resumeLabel and classNames.playback. Reduced motion keeps the manual controls available.

In manual mode, swiping, arrows, dots and keyboard navigation share the same page index. Use index and onIndexChange to control it. Navigation is omitted when the cards fit. On narrow screens, the controls sit below the cards to keep the card content clear.

TiltedCarousel and its stylesheet @pimolu/web-styles/tilted-carousel.css are available in the current workspace ahead of publication.

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.

TiltedCarouselProps

Type source
TiltedCarouselProps 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.
gapnumber20Space between slides in pixels. Defaults to 20.
classNames(CarouselStageClassNames & { playback?: string; })—Additive classes for the stable named parts, including the playback button. Named parts are listed in the Class names table.
tiltnumber3Maximum card rotation in degrees. Each card keeps a deterministic tilt from the fixed pattern, so the rail stays scattered while it moves. Defaults to 3.
autoScrollbooleanfalseLoops decorative slides while there is overflow. Respects reduced motion. Defaults to false.
autoScrollDirection"ltr" | "rtl""ltr"Direction of the continuous scroll: "ltr" moves cards left, "rtl" moves them right. Defaults to "ltr".
speednumber40Continuous scroll speed in pixels per second. Defaults to 40.
pauseLabelstring"Pause automatic scroll"Visible label for the automatic scroll pause button.
resumeLabelstring"Resume automatic scroll"Visible label for the automatic scroll resume button.
slidesPerViewnumber—Number of cards visible at once. Cards shrink so the requested count fits the rail; without it, cards use the natural editorial width.
slideWidthstring—CSS width for each card. Overrides slidesPerView.
viewportHeightstringclamp(260px, 40vw, 380px)CSS height for the track. Defaults to clamp(260px, 40vw, 380px).
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: 20

Space between slides in pixels. Defaults to 20.

classNames

(CarouselStageClassNames & { playback?: string; })

No default extracted.

Additive classes for the stable named parts, including the playback button. Named parts are listed in the Class names table.

tilt

number

Default: 3

Maximum card rotation in degrees. Each card keeps a deterministic tilt from the fixed pattern, so the rail stays scattered while it moves. Defaults to 3.

autoScroll

boolean

Default: false

Loops decorative slides while there is overflow. Respects reduced motion. Defaults to false.

autoScrollDirection

"ltr" | "rtl"

Default: "ltr"

Direction of the continuous scroll: "ltr" moves cards left, "rtl" moves them right. Defaults to "ltr".

speed

number

Default: 40

Continuous scroll speed in pixels per second. Defaults to 40.

pauseLabel

string

Default: "Pause automatic scroll"

Visible label for the automatic scroll pause button.

resumeLabel

string

Default: "Resume automatic scroll"

Visible label for the automatic scroll resume button.

slidesPerView

number

No default extracted.

Number of cards visible at once. Cards shrink so the requested count fits the rail; without it, cards use the natural editorial width.

slideWidth

string

No default extracted.

CSS width for each card. Overrides slidesPerView.

viewportHeight

string

Default: clamp(260px, 40vw, 380px)

CSS height for the track. Defaults to clamp(260px, 40vw, 380px).

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

8 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
  • playback
  • previous
  • root
  • slide
  • viewport

CSS variables

66 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-button-active-shadow
  • --pimolu-button-active-transform
  • --pimolu-button-font-weight
  • --pimolu-button-height
  • --pimolu-button-letter-spacing
  • --pimolu-button-padding-x
  • --pimolu-carousel-controls-center
  • --pimolu-carousel-gap
  • --pimolu-carousel-per-view
  • --pimolu-control-background
  • --pimolu-control-border
  • --pimolu-control-border-width
  • --pimolu-control-foreground
  • --pimolu-control-shadow
  • --pimolu-danger
  • --pimolu-danger-foreground
  • --pimolu-danger-hover
  • --pimolu-focus-ring
  • --pimolu-font-body
  • --pimolu-foreground
  • --pimolu-glass-bg
  • --pimolu-glass-bg-hover
  • --pimolu-glass-blur
  • --pimolu-glass-border
  • --pimolu-glass-shadow
  • --pimolu-interaction-duration
  • --pimolu-interaction-easing
  • --pimolu-muted
  • --pimolu-muted-foreground
  • --pimolu-neutral
  • --pimolu-neutral-foreground
  • --pimolu-neutral-hover
  • --pimolu-outline-hover-border
  • --pimolu-primary
  • --pimolu-primary-foreground
  • --pimolu-primary-hover
  • --pimolu-radius-full
  • --pimolu-radius-lg
  • --pimolu-radius-md
  • --pimolu-radius-sm
  • --pimolu-secondary
  • --pimolu-secondary-foreground
  • --pimolu-secondary-hover
  • --pimolu-shadow-raised
  • --pimolu-soft-border-color
  • --pimolu-solid-border-color
  • --pimolu-spacing-2
  • --pimolu-spacing-3
  • --pimolu-spacing-4
  • --pimolu-spacing-5
  • --pimolu-spacing-6
  • --pimolu-spacing-8
  • --pimolu-success
  • --pimolu-success-foreground
  • --pimolu-success-hover
  • --pimolu-surface
  • --pimolu-surface-foreground
  • --pimolu-tilted-default-width
  • --pimolu-tilted-slide-width
  • --pimolu-tilted-tilt
  • --pimolu-tilted-viewport-height
  • --pimolu-warning
  • --pimolu-warning-foreground
  • --pimolu-warning-hover

Accessibility

  • Give the rail an aria-label. Focus the viewport to use ArrowLeft, ArrowRight, Home or End. Use the pause button to turn continuous motion off.
Read the accessibility guide →