Carousel

This component displays a slideshow by cycling through elements (images, text, or custom slides) like a carousel.

Properties

autoplay (default: false)

Start scrolling the carousel automatically (true) or not (false).

autoplayInterval (default: 5000)

Specifies the interval between autoplay transitions.

controls (default: true)

Display the previous/next controls (true) or not (false).

indicators (default: true)

Display the individual slides as buttons (true) or not (false).

loop (default: false)

Sets whether the carousel should loop back to the start/end when it reaches the last/first slide.

nextIcon

The icon to display for the next control.

orientation (default: "horizontal")

This property indicates the orientation of the carousel. The horizontal value indicates that the carousel moves horizontally, and the vertical value indicates that the carousel moves vertically.
Available values: horizontal (default), vertical

prevIcon

The icon to display for the previous control.

startIndex (default: 0)

The index of the first slide to display.

stopAutoplayOnInteraction (default: true)

This property indicates whether autoplay stops on user interaction.

transitionDuration (default: 25)

The duration of the transition between slides.

Events

displayDidChange

This event is fired when the displayed content of the CarouselNew changes.

Exposed Methods

canScrollNext

This method returns true if the carousel can scroll to the next slide.
Signature: canScrollNext(): boolean

canScrollPrev

This method returns true if the carousel can scroll to the previous slide.
Signature: canScrollPrev(): boolean

scrollNext

This method scrolls the carousel to the next slide.
Signature: scrollNext(): void

scrollPrev

This method scrolls the carousel to the previous slide.
Signature: scrollPrev(): void

scrollTo

This method scrolls the carousel to the specified slide index.
Signature: scrollTo(index: number): void
  • index: The index of the slide to scroll to.

Styling

Theme Variables

VariableDefault Value (Light)Default Value (Dark)
backgroundColor-control-active-Carouselnonenone
backgroundColor-control-active-CarouselNew$color-primary$color-primary
backgroundColor-control-Carouselnonenone
backgroundColor-control-CarouselNew$color-primary$color-primary
backgroundColor-control-disabled-Carouselnonenone
backgroundColor-control-disabled-CarouselNew$color-surface-200$color-surface-200
backgroundColor-control-hover-Carouselnonenone
backgroundColor-control-hover-CarouselNew$color-primary$color-primary
backgroundColor-indicator-active-Carouselnonenone
backgroundColor-indicator-active-CarouselNew$color-primary$color-primary
backgroundColor-indicator-Carouselnonenone
backgroundColor-indicator-CarouselNew$color-surface-200$color-surface-200
backgroundColor-indicator-hover-Carouselnonenone
backgroundColor-indicator-hover-CarouselNew$color-surface-200$color-surface-200
borderRadius-control-Carouselnonenone
borderRadius-control-CarouselNew50%50%
height-Carouselnonenone
height-CarouselNew100%100%
height-control-Carouselnonenone
height-control-CarouselNew36px36px
height-indicator-Carouselnonenone
height-indicator-CarouselNew6px6px
textColor-control-active-Carouselnonenone
textColor-control-active-CarouselNew$color-primary$color-primary
textColor-control-Carouselnonenone
textColor-control-CarouselNew$textColor$textColor
textColor-control-disabled-Carouselnonenone
textColor-control-disabled-CarouselNew$textColor-disabled$textColor-disabled
textColor-control-hover-Carouselnonenone
textColor-control-hover-CarouselNew$textColor$textColor
textColor-indicator-active-Carouselnonenone
textColor-indicator-active-CarouselNew$color-primary$color-primary
textColor-indicator-Carouselnonenone
textColor-indicator-CarouselNew$color-primary$color-primary
textColor-indicator-hover-Carouselnonenone
textColor-indicator-hover-CarouselNew$color-primary$color-primary
width-Carouselnonenone
width-CarouselNew100%100%
width-control-Carouselnonenone
width-control-CarouselNew36px36px
width-indicator-Carouselnonenone
width-indicator-CarouselNew25px25px