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-haptics

Usage

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

PropTypeDefaultDescription
childrenReactNodeOne child per page.
peeknumber0.86Page width as a share of the carousel; 1 hides the next page.
gapnumber12Space between pages.
dotsbooleantrueShow the page dots.
onIndexChange(index: number) => void–Called when a new page settles.

PageControl

PropTypeDefaultDescription
countnumberNumber of pages.
indexnumberCurrent page.
onChange(index: number) => void–Makes the dots tappable.