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

Usage

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

PropTypeDefaultDescription
titlestring–Section heading.
footerstring–Note under the section.
childrenListItem[]The rows.

ListItem

PropTypeDefaultDescription
titlestringRow text.
subtitlestring–Second line.
leftReactNode–Icon or avatar on the leading edge.
rightReactNode–A control, such as a Switch, on the trailing edge.
valuestring–Value text on the trailing edge.
onPress() => void–Makes the row tappable.
chevronbooleanon with onPressiOS chevron for rows that open another screen.
destructivebooleanfalseRed title, for Sign out or Delete.
selectedbooleanfalseA check on the row, for single-choice lists.