Carousel

Carousel is a content slider featuring various customization options.

Composition-based carousel using native scroll-snap with sub-components for root, content, items, navigation, and indicators.

1
2
3
4
5

Composition-based carousel using native scroll-snap with sub-components for root, content, items, navigation, and indicators.

1
2
3
4
5
basic-demo

Use align to control snap alignment and slidesPerPage to show partial slides.

1
2
3
4
5
alignment-demo

Enable continuous looping with the loop property. Use slidesPerPage to show partial slides.

1
2
3
4
5
loop-demo

Set orientation to vertical for a vertical carousel layout.

1
2
3
4
5
orientation-demo

Enable autoSize to allow items with variable widths.

1
2
3
4
5
6
7
8
variable-size-demo

Two carousels synchronized via slide input to create a gallery with thumbnail navigation.

Image 1Image 2Image 3Image 4Image 5Image 6Image 7Image 8Image 9Image 1Image 2Image 3Image 4Image 5Image 6Image 7Image 8Image 9
gallery-demo

Screen Reader

Carousel uses region role and since any attribute is passed to the main container element, attributes such as aria-label and aria-roledescription can be used as well. The slides container has aria-live attribute set as "polite" if carousel is not in autoplay mode, otherwise "off" would be the value in autoplay.

A slide has a group role with an aria-label that refers to the aria.slideNumber property of the locale API. Similarly aria.slide is used as the aria-roledescription of the item. Inactive slides are hidden from the readers with aria-hidden.

Next and Previous navigators are button elements with aria-label attributes referring to the aria.nextPageLabel and aria.firstPageLabel properties of the locale API by default respectively, you may still use your own aria roles and attributes as any valid attribute is passed to the button elements implicitly by using nextButtonProps and prevButtonProps.

Quick navigation elements are button elements with an aria-label attribute referring to the aria.pageLabel of the locale API. Current page is marked with aria-current.

Next/Prev Keyboard Support

KeyFunction
tabMoves focus through interactive elements in the carousel.
enterActivates navigation.
spaceActivates navigation.

Quick Navigation Keyboard Support

KeyFunction
tabMoves focus through the active slide link.
enterActivates the focused slide link.
spaceActivates the focused slide link.
right arrowMoves focus to the next slide link.
left arrowMoves focus to the previous slide link.
homeMoves focus to the first slide link.
endMoves focus to the last slide link.
ON THIS PAGE
Templates
Highly customizable application templates to get started in no time with style. Designed and implemented by PrimeTek.
Learn More