Skip to main content

Page Indicators

Indicators that show what page the carousel is on. These pages are calculated from the scrollDistance and have to be styled in addition to setting the showPageIndicators boolean to true.

Details

Prop NameTypeDefault Value
showPageIndicatorsbooleanfalse

Example

Code

<Carousel showPageIndicators={true}>
<img src="pexels-01.jpg" />
<img src="pexels-02.jpg" />
<img src="pexels-03.jpg" />
</Carousel>

Styling

pageIndicatorProps Details

Prop NameTypeDefault Value
pageIndicatorPropsobject (see below)see below
containerClassNamestringundefined
currentPageIndicatorClassNamestringundefined
pageIndicatorClassNamestringundefined

Example

Code

<Carousel
showPageIndicators={true}
pageIndicatorProps={{
containerClassName: 'flex items-center justify-center py-4 gap-2',
pageIndicatorClassName:
'w-3 h-3 p-0 rounded-full bg-gray-200 border-none cursor-pointer hover:bg-pink-200',
currentPageIndicatorClassName: 'bg-pink-500 hover:bg-pink-500',
}}
scrollDistance="screen"
>
<img src="pexels-01.jpg" />
<img src="pexels-02.jpg" />
<img src="pexels-03.jpg" />
</Carousel>