Intro Pager
React Native (Expo)
A swipeable React Native onboarding pager where the art drifts against the text, the dots stretch, and Next turns into the final action.
A swipeable onboarding pager. The art drifts against the text as you swipe, the dots stretch to show where you are, and the button turns from Next into the final action on the last page. On the web it also pages with a mouse drag, which a scroll view does not do by itself. With reduced motion the art stays put. Built for React Native and Expo with react-native only; this page previews it in the browser through react-native-web.
Installation
CLI
npx @modus-ui/cli add intro-pagerManual
- Copy the code from the component tab.
- Create a file at
components/ui/intro-pager.tsx. - Paste the code.
It needs no packages beyond react-native, which your Expo or React Native app already has.
Usage
tsx
The pager fills its parent, so give the parent a height (a screen with flex: 1 is enough).
Props
| Prop | Type | Default | Description |
|---|---|---|---|
pages | IntroPage[] | - | The pages. Each has an id, a title, a description and an art node. |
onDone | () => void | - | Called when the button is pressed on the last page. |
skipLabel | string | "Skip" | Label of the skip button, shown until the last page. |
nextLabel | string | "Next" | Label of the button until the last page. |
doneLabel | string | "Get started" | Label the button morphs into on the last page. |
colors | Partial<IntroPagerColors> | - | Overrides background, title, text, dot, activeDot, button and buttonText. |
style | StyleProp<ViewStyle> | - | Style for the container. |
Comments