Page Control
A row of dots that shows the current page of a carousel and moves between its pages.
import { PageControl } from "@plexui/react-native"Examples
Overview
Platforms
| iOS 26 | Android | |
|---|---|---|
| Native component | Page control | None: the Plex Android page dots |
| Look | 8pt dots in a capsule that shows while pressed | 5dp gray dots, the current one in the accent and stretching as it moves, in a 48dp target |
API
| Prop | Type | Default | Description |
|---|---|---|---|
count | number | — | The number of pages |
value | number | — | The current page's index, from 0 (controlled) |
defaultValue | number | 0 | The first page's index (uncontrolled) |
position | number | Animated.Value | — | The pages' scroll as a fractional page (offset over the page's length) that the pill and the dots' color follow on every frame; without it a new value moves over a short transition |
onChange | (index: number, details: { scrubbing: boolean }) => void | — | Called with the next page's index; scrubbing is true when a drag changed it, so the page can show without the scroll animation |
background | "automatic" | "prominent" | "minimal" | "automatic" | The capsule behind the dots: while pressed, always, or never (and no scrubbing). iOS only: Android draws none |
indicator | "dots" | "pill" | "dots" | How the current page shows: a solid dot, the platforms' own, or a short capsule two and a half dots wide among the dots |
indicatorIcon | (index: number) => ReactNode | — | An icon in place of a page's dot (UIPageControl's setIndicatorImage(_:forPage:)), nothing for a dot: in the dots' colors, 12pt on iOS, 10dp on Android |
tone | "default" | "onColor" | "default" | The dots in the label colors, or in white for a page of color or a photo behind them (the rest white at 40%, the capsule a white veil); over a photo that may be light, lay it in a MediaMark for the platform's darkening |
size | "md" | "sm" | "md" | The platform's own dots, or smaller ones for a control over a photo in a card: 5pt dots 4 apart on iOS (the pill 14 long), 4dp 4 apart on Android, the capsule 16 thick |
direction | "horizontal" | "vertical" | "horizontal" | The dots in a row, or in a column for pages that scroll up and down (UIPageControl's direction); scrubbing follows it |
valueText | (index: number, count: number) => string | Page {index + 1} of {count} | What screen readers say for the current page |
aria-label | string | "Pages" | Name of the control for screen readers |
testID | string | — | Test id |
style | StyleProp<ViewStyle> | — | Style of the touch target |
pageControlMetrics
pageControlMetrics(theme, size) returns the measures the control draws at a size (dots alone): dot, gap, padding (at each end of the row), thickness (the room it takes across the dots: 24, 16 at sm), inset (the room between its edge and its dots, (thickness - dot) / 2: 5.5 at sm on iOS, 6 on Android) and target (44, 48 on Android, reaching past the capsule without taking room). Set the room round the control from them, so the dots stand a given distance from a picture over them and from the words under them:
import { PageControl, pageControlMetrics, useTheme } from "@plexui/react-native"
import { View } from "react-native"
const theme = useTheme()
const { inset } = pageControlMetrics(theme, "sm")
// The dots 12 under the picture: the room on a View round the control, whose own margins reach its target past it
<View style={{ marginTop: 12 - inset }}>
<PageControl count={5} value={page} size="sm" />
</View>