Carousel pagination

Use carousel pagination to navigate a collection of items.

Ready to use
import {CarouselPagination} from '@primer/react-brand'

Examples

Default

Loading

Looping navigation

Use loop to let the previous and next controls wrap between the first and last items.

Loading

Accessible labels

Provide translated labels for both arrow controls and the numbered item selectors.

Loading

Component props

NameTypeDefaultDescription
itemCountnumberTotal number of carousel items. Controls are hidden when fewer than two.
activeIndexnumberZero-based active item index.
onChange(activeIndex: number) => voidRequests a new active index. The parent remains responsible for selection.
loopbooleanfalseWraps previous and next navigation at the collection boundaries.
labelsCarouselPaginationLabelsEnglishAccessible labels for arrow controls and the numbered selectors.
itemAttributesBuilder(index: number) => CarouselPaginationItemAttributesAdds attributes or a composed click handler to an item selector.
aria-labelstringRequired accessible name for the complete control group.
classNamestringCustom root class.
idstringCustom root ID.
refReact.Ref<HTMLDivElement>Ref to the root element.