rslabdocs

Pagination Dots

A carousel indicator where the active dot widens into a pill and slides between pages.

ReanimatedHapticsNativeWindSource

Prerequisites

Reanimated drives the width/color interpolation, Haptics fires a tick when a dot is tapped directly.


npx expo install expo-haptics react-native-reanimated

Install


npx @rslab/cli add pagination-dots

Usage


import { PaginationDots } from '@/components/ui/PaginationDots';



const [page, setPage] = useState(0);



<PaginationDots count={4} index={page} />



<PaginationDots count={8} index={page} size={5} activeWidth={22} gap={5} />

Pass onDotPress to make the dots tappable and jump the carousel directly:

<PaginationDots count={5} index={page} onDotPress={setPage} />

Props

PropTypeDefault
count
number
-

Total number of pages/dots.

index
number
-

Controlled active index, e.g. driven by a carousel's scroll position.

size?
number
6

Inactive dot diameter.

activeWidth?
number
18

Active dot's pill width.

color?
string
-

Active dot color. Defaults to a neutral dark/light tone via useColorScheme().

gap?
number
6

Spacing between dots.

onDotPress?
(index: number) => void
-

Optional. If provided, dots become tappable and fire this with the tapped index, plus a selection haptic.

className?
string
-

Extend or override the outer row.

See exactly how this works with an RSLAB subscription.

Get Pro

On this page