Skip to main content

Carousel

The carousel is a wrapper component that contains multiple slides, which can be other components (e.g. Banners), images, or fully custom content.

Example

Live Editor
Result
Loading...

Usage Rules

Do:

  • Always have at least one of the two navigation elements for the carousel.

Don't:

  • Hide both Navigation and Pagination of the Carousel.

Variants

AutoPlay

The Carousel autoplay will be activated by adding autoplay object with a delay prop in settings as below. The autoplay can be disabled on interactions by adding disableOnInteraction: true in autoplay object.

Live Editor
Result
Loading...

Center mode

The Carousel center mode can be activated by adding centeredSlides: true in settings.

Live Editor
Result
Loading...

Dynamic Width

You need to add slidesPerView: 'auto' to the settings to have auto width style in carousel.

Live Editor
Result
Loading...

Infinite Loop

The Carousel infinite loop mode can be activated by adding loop: true in settings.

Live Editor
Result
Loading...

Infinite Loop with slides per group

The Carousel infinite loop with slides per group can be customized using slidesPerGroup and loopFillGroupWithBlank in settings.

Live Editor
Result
Loading...

Multi Slides

The Carousel can be multi slides by adding slidesPerView in settings.

Live Editor
Result
Loading...

Carousel navigation is optional and can be controlled with hasNavigation prop.

Live Editor
Result
Loading...

Pagination

Carousel pagination is optional and can be controlled with hasPagination prop.

Live Editor
Result
Loading...

Props

NameTypeDefault
slides *
The slides array
ReactNode[]
settings
The carousel settings
SettingsType
"{ spaceBetween: 16 }"
onSlideChange
Event will be fired when currently active slide is changed
((swiper: Swiper) => void)
onReachBeginning
Event will be fired when Carousel reaches its beginning (initial position)
((swiper: Swiper) => void)
onReachEnd
Event will be fired when Carousel reaches last slide
((swiper: Swiper) => void)
css
Add custom styles to this component. Use with caution. Learn more here: Link
SupportedStyleAttributes
inputFieldCss
SupportedStyleAttributes
data-{foo}
Data attributes can be used by testing libraries to retrieve components or assert their existence
string
* - the prop is required.