Components
Carousel

Carousel

The Carousel component is a dynamic and responsive content display tool for your applications. It provides support for various configurations, including slide alignment, text direction, and slide orientation.

API reference docs for the component. Learn about the props, CSS, and other APIs of this exported module.

CarouselProps

align

'center' | 'end' | 'start'

The alignment of the slides in the carousel.

dir

'ltr' | 'rtl'

The document's text/writing direction.

getRootNode

() => ShadowRoot | Node | Document

A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron.

id

string

The unique identifier of the machine.

ids

Partial<{ root: string viewport: string slide(index: number): string slideGroup: string nextSlideTrigger: string prevSlideTrigger: string indicatorGroup: string indicator(index: number): string }>

The ids of the elements in the carousel. Useful for composition.

index

number

The current slide index.

loop

boolean

Whether the carousel should loop around.

onSlideChange

(details: SlideChangeDetails) => void

Function called when the slide changes.

orientation

'horizontal' | 'vertical'

The orientation of the carousel.

slidesPerView

number | 'auto'

The number of slides to show at a time.

spacing

string

The amount of space between slides.

CarouselContext

canScrollNext

boolean

Whether the carousel is can scroll to the next slide

canScrollPrev

boolean

Whether the carousel is can scroll to the previous slide

getIndicatorProps

(props: SlideIndicatorProps) => Dict<any>

getSlideProps

(props: SlideProps) => Dict<any>

getSlideState

(props: SlideProps) => SlideState

Returns the state of a specific slide

index

number

The current index of the carousel

indicatorGroupProps

Dict<any>

isAutoplay

boolean

Whether the carousel is currently auto-playing

nextSlideTriggerProps

Dict<any>

pause

() => void

Function to pause autoplay

play

() => void

Function to start/resume autoplay

prevSlideTriggerProps

Dict<any>

rootProps

Dict<any>

scrollProgress

number

The current scroll progress of the carousel

scrollTo

(index: number, jump?: boolean | undefined) => void

Function to scroll to a specific slide index

scrollToNext

() => void

Function to scroll to the next slide

scrollToPrevious

() => void

Function to scroll to the previous slide

slideGroupProps

Dict<any>

viewportProps

Dict<any>

CarouselSlideProps

index

number

CarouselIndicatorProps

index

number

readOnly

boolean