Page dots
Expanding current-page markers with optional named page navigation.
npx @swipeui/cli add page-dotsWhen to use it
- Showing which page you're on in an onboarding carousel or photo gallery.
- Tappable dots that jump to a page.
- Paging indicators under a Carousel.
When not to use it
- More than about 10 pages; show "3 of 24" instead.
- Step-by-step flows. Use Stepper.
- Progress through content. Use Progress.
Installation
Run this from your app's root. If SwipeUI isn't set up yet, run npx @swipeui/cli init first; it sets up Uniwind, the theme tokens and the cn helper.
npx @swipeui/cli add page-dots- Adds
components/swipeui/ui/page-dots.tsxand 5 shared helpers. - Installs react-native-reanimated, clsx, tailwind-merge, react-native-worklets, uniwind, expo-haptics. In Expo apps it uses
npx expo installso versions match your SDK.
Usage
import { PageDots } from '@/components/swipeui/ui/page-dots';
<PageDots count={4} current={page} />;Examples
Use the variant and appearance controls in the live specimen to compare the documented states. The application owns validation, operation results and persistence.
API reference
PageDotsProps
| Prop | Type | Default | Description |
|---|---|---|---|
messages? | | | Translated page labels; page is one based. |
activeShape? | | | Active marker shape. |
count | | — | Page count, integer 1–50. |
current | | — | Current page, zero based. |
onPageChange? | | — | Enables named page navigation. |
motion? | | — | Shared selection motion. |
className? | | — | Root classes. |
style? | | — | Native layout escape hatch. |
testID? | | — | Root ID. |
Native view/input props not listed here pass through where the exported TypeScript type allows them.
Composition and behavior
- count dots with the current one highlighted.
- onPageChange makes them tappable.
Feedback lineup settings
| Prop | Does / default |
|---|---|
activeShape | Active marker shape. @default 'pill' |
count | Page count, integer 1–50. |
current | Current page, zero based. |
onPageChange | Enables named page navigation. |
motion | Shared selection motion. |
className | Root classes. |
style | Native layout escape hatch. |
testID | Root ID. |
Behavior and gestures
- The current dot stretches into a pill so it's easy to spot.
- With onPageChange, tap a dot to jump to that page; tapping the current dot does nothing.
Accessibility
- Read-only dots announce "Page 2 of 5".
- Interactive dots are buttons named "Page 3 of 5", with the current one selected.
- Dots keep 44-point touch targets when tappable.
Motion
- Uses the
selectandpressmotion roles, so it follows your app's feel. Passmotionto tune this one instance. - The current dot widens with the select spring.
- Reduce Motion changes it instantly.
Performance
- Up to 50 dots, each a tiny animated view.
Notes for AI
- current is zero-based; count must be 1 to 50.
Compatibility
| Runs on | Supported |
|---|---|
| Expo SDK 57 | Yes |
| Expo SDK 58 | Yes |
| React Native CLI (with Expo modules) | Yes |
| Expo Go | Yes |
| iOS | Yes |
| Android | Yes |
This table describes API support and static bundle checks. Native runtime, device accessibility and bare Uniwind compatibility remain pending.