Mobile › Lists and layout
Carousel
Cards that snap one page at a time, showing the edge of the next, with page dots under them. PageControl is the dots on their own.
Installation
npx expo install plankui-mobile react-native-safe-area-context expo-hapticsUsage
import { Carousel, PageControl } from "plankui-mobile";
<Carousel>
<Card>…</Card>
<Card>…</Card>
<Card>…</Card>
</Carousel>
<PageControl count={4} index={page} onChange={setPage} />iOS and Android
iOS: Pages run edge to edge past the screen padding, like App Store cards; the current dot stretches into a pill.
Android: The same snapping row and dots, as in Material carousels.
API reference
| Prop | Type | Default | Description |
|---|---|---|---|
| children | ReactNode | One child per page. | |
| peek | number | 0.86 | Page width as a share of the carousel; 1 hides the next page. |
| gap | number | 12 | Space between pages. |
| dots | boolean | true | Show the page dots. |
| onIndexChange | (index: number) => void | – | Called when a new page settles. |
PageControl
| Prop | Type | Default | Description |
|---|---|---|---|
| count | number | Number of pages. | |
| index | number | Current page. | |
| onChange | (index: number) => void | – | Makes the dots tappable. |