Mobile › Lists and layout
ListSection and ListItem
Grouped rows for settings, menus and records, with icons, values, controls and chevrons.
Installation
npx expo install plankui-mobile react-native-safe-area-context expo-hapticsUsage
import { ListSection, ListItem, Switch } from "plankui-mobile";
<Screen grouped header={<NavBar title="Settings" variant="large" grouped />}>
<ListSection title="Account" footer="Signed in as Alex.">
<ListItem title="Profile" left={<Avatar name="Alex Kim" size={32} />} onPress={openProfile} />
<ListItem title="Language" value="English" onPress={pickLanguage} />
<ListItem title="Push notifications" right={<Switch value={push} onValueChange={setPush} />} />
<ListItem title="Sign out" destructive onPress={signOut} />
</ListSection>
</Screen>iOS and Android
iOS: Inset grouped cards with hairlines and uppercase section headings.
Android: Full-width rows under an accent section label, with ripples.
API reference
| Prop | Type | Default | Description |
|---|---|---|---|
| title | string | – | Section heading. |
| footer | string | – | Note under the section. |
| children | ListItem[] | The rows. |
ListItem
| Prop | Type | Default | Description |
|---|---|---|---|
| title | string | Row text. | |
| subtitle | string | – | Second line. |
| left | ReactNode | – | Icon or avatar on the leading edge. |
| right | ReactNode | – | A control, such as a Switch, on the trailing edge. |
| value | string | – | Value text on the trailing edge. |
| onPress | () => void | – | Makes the row tappable. |
| chevron | boolean | on with onPress | iOS chevron for rows that open another screen. |
| destructive | boolean | false | Red title, for Sign out or Delete. |
| selected | boolean | false | A check on the row, for single-choice lists. |