List
A section of rows for settings and navigation.
import { List, ListItem } from "@plexui/react-native"End a row with a Switch for a setting that turns on and off.
Examples
Overview
Count in the header
Disclosure rows
Pick several
A button of its own
Platforms
| iOS 26 | Android | |
|---|---|---|
| Native component | Inset grouped list | List (a Settings preference group) |
| Look | A section with 26pt corners, 52pt rows 20pt in from its edges, hairlines from the text's start, the value at the end and a chevron on a row that opens a page | One card of the section's rows with 16dp corners: rows 50dp tall at least, the label 16sp, the value 16sp in the accent 17dp from the end, a divider from the text's start (none under a row with a tile); no chevron |
surface="plain" | The section in the secondary gray on a white screen | A plain list: no card, the rows across the screen, the header a 32dp gray band |
On Android a footer stands 13dp into the card's width, as in the Settings app; a screen that keeps text outside a card at the card's edge sets --list-android-footer-inset to 0. On iOS a picture wider than the 28pt tile, such as a 40pt avatar or a photo, keeps its own size: it starts at the row's 20pt inset, where the header and the footer stand, and the text follows 14pt past it.
API
List
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | — | The rows: ListItem elements |
header | ReactNode | — | The title over the section; it names the list for screen readers |
description | ReactNode | — | A line under the header, in the secondary label |
footer | ReactNode | — | A note under the section |
error | ReactNode | — | An error under the section: it takes the footer's place and type (iOS 13/16, Android 14sp), only in the danger color, and is announced when it appears |
action | ReactNode | — | Content at the end of the header: a ghost Button is its text action; a string, a number or a Text (a count such as "2/3") takes the header's type in the secondary label, on the title's line. Without a header it stands alone at the header's end |
surface | "grouped" | "plain" | "grouped" | The canvas the section stands on: the grouped background of a settings screen, or a plain screen |
aria-label | string | — | Name of the list for screen readers; defaults to the header's text |
testID | string | — | Test id |
style | StyleProp<ViewStyle> | — | Style of the section |
ListStack
Sections one under another, spaced as SwiftUI's Form and the web's stacked FieldGroups: on iOS 35pt rows to rows, less what a footer's block and a header's take (a header counts with its description or its action alone, such as a Select all over the rows); on Android 12dp apart, none after a footer. Each List tells the stack its shape, so a List inside a component of the app's own is spaced as a direct one, and a ListDisclosure's rows stay in its section. A block that is not a section (a note, a button, a picture) beside a section is spaced as a section with no header and no footer, as a Form sets a view outside a Section in a section of its own (iOS 27.2: 35pt from its neighbors); two such blocks keep gap. A brand sets the gap with --field-group-gap (--field-group-gap-android), as useListMetrics().sectionGap reads it. It ends as a Form ends, measured on iOS 27.2: 20pt under the last rows, none past a footer, whose block takes it; on Android 16dp.
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | — | The sections (List) and any blocks between them |
gap | number | 0 | The space between two blocks that are neither of them a section |
end | boolean | "room" | true | The room under the last block: iOS 20pt (none past a footer) over the home indicator, Android at least 16dp over the system's bar. room keeps the room alone, for a screen that already stands its content over the inset (a scroll view or a floating action that pads it); false for a stack that is not the screen's end, such as one inside another ListStack |
start | boolean | false | The room over the first block, as a Form starts under a navigation bar, measured on iOS 26 Settings: a first section with no header (or a block that is not a section) has its card 17.67pt under the bar's foot; one with a header has the header's block 1.33pt under it, its card 40.33pt; a prominent header's block 2pt. Android adds none. For a stack that stands right under a bar |
testID | string | — | Test id |
style | StyleProp<ViewStyle> | — | Style of the stack |
ListDisclosure
| Prop | Type | Default | Description |
|---|---|---|---|
label | ReactNode | — | The row's text |
description | ReactNode | — | A line under the label, in the secondary label |
leading | ReactNode | — | A symbol or a tile before the text, as a ListItem's |
leadingColor | string | — | The fill of the leading tile |
value | ReactNode | — | A value at the end, before the chevron |
chevron | "disclosure" | "accordion" | "disclosure" | The chevron on iOS: DisclosureGroup's (right in the label's color, a quarter turn down when open) or an accordion's (down in the drill-in's gray, a half turn up). Android ends in expand_more either way |
expanded | boolean | — | Whether its rows show, when the app holds it (with onExpandedChange) |
defaultExpanded | boolean | false | Whether its rows show at first, when the row holds its own state |
onExpandedChange | (expanded: boolean) => void | — | Called when the row opens or closes |
children | ReactNode | — | The rows it opens: ListItem elements, in the same section |
disabled | boolean | false | Greys the row and keeps it closed as it is |
accessibilityLabel | string | — | The row's name for screen readers; defaults to the label and the value |
accessibilityHint | string | — | What a press does, read after the name |
testID | string | — | Test id |
useListMetrics
Returns { rowInset, radius, sectionGap, top, headerTop }: where a row's text starts, the section's corner radius, the space between two sections and where the first section stands under a bar on this platform, for a block that lines up with a section or stands as one. sectionGap is rows to rows: on iOS --field-group-gap (35, the web's stacked FieldGroups read the same token), on Android --field-group-gap-android (12). A ListStack spaces its sections and the blocks beside them by it, so a brand that sets it moves both. On iOS the stack takes a header's or a footer's block out of the gap; on Android it leaves none after a footer. top and headerTop are where a Form's first section stands under a navigation bar's foot on iOS, measured on iOS 26 Settings: its card with no header 17.67, its header's block 1.33 (the card then 40.33). They are what ListStack's start adds, and 0 on Android.
usePageMetrics
usePageMetrics({ tabBar, actions }) returns { gutter, contentTop, headingTop, introTop, introEnd, contentEnd, bottom, floatGap, floatBottom }: where a screen of an app's own stands its lists, cards and fields. Each value comes from the kit's page tokens, the web Page's, and a brand can set any of them:
gutter: from the screen's sides to the blocks. On iOS it is--page-gutter: 16, or 20 from 414pt wide, iOS's layout margin. On Android it is--page-gutter-android: 16, Material's compact margin.contentTop: from a bar's bottom to the first block,--page-content-padding-top(16).headingTop: from a compact bar's bottom to a screen's first heading (its title's line box) when the content scrolls under the bar,--page-heading-top(16 on both platforms). It is deeper than a brand'scontentTopoften is, so the heading stands clear of the bar's soft edge.introTop: from a bar's bottom (or the page's top) to an Intro Header that opens with its symbol, to the symbol's box,--page-intro-top(8). The symbol's drawing then stands about 24 under the bar's buttons.introEnd: from an Intro Header to the content under it,--page-intro-end(24).contentEnd: the room after the last block.- Over nothing at the screen's bottom:
--page-content-padding-bottom(48). - Over a tab bar (
tabBar,trueor the bar's ownsafeArea,minimizedandaccessory) or floating BottomActions (actions, how many):--page-bar-soft-bottom-reachon iOS (34, where a bottom bar's soft edge starts),--page-content-end-androidon Android (16). Actions win over a tab bar.
- Over nothing at the screen's bottom:
bottom: what stands at the screen's bottom (or the safe area) pluscontentEnd, a scroll'spaddingBottomwhen it runs under it.floatGap: the tab bar's, fromuseTabBarMetrics.floatBottom: the tab bar's top (or the safe area) plusfloatGap, a floating control'sbottom.
An app's own numbers go in its brand's tokens, for example --page-content-padding-top: 8px and --page-content-padding-bottom: 24px.
ListItem
| Prop | Type | Default | Description |
|---|---|---|---|
label | ReactNode | — | The row's text |
description | ReactNode | — | Secondary text under the label: touching it on iOS, as Settings, 4 under it on Android; a brand sets that gap with --list-row-description-gap and --list-row-description-gap-android, and the row grows by it, keeping its padding |
leading | ReactNode | — | A symbol at the start |
leadingColor | string | — | The fill of the leading tile, where the symbol turns white |
leadingSize | number | — | The leading picture's size when it is not a symbol (a 40 photo): the row takes its height from the first frame. Without it the row reads the picture before its first frame where it can (the web, the new architecture), else on layout |
value | ReactNode | — | The current value at the end: in the secondary gray on iOS, in the accent on Android |
valueColor | "secondary" | "accent" | "secondary" on iOS, "accent" on Android | The color of the value at the end, and of a Select's value in the row: the secondary gray or the accent |
valuePlacement | "end" | "below" | "auto" | "end" | Where the value stands: at the end, below the label, or below only when the label and the value do not fit beside each other on one line; below the label it is in the secondary gray (13sp on Android) |
selected | boolean | — | A choice row's check at the end: iOS's 20pt checkmark in the accent, Android's 24dp in the primary; false keeps its room empty, so the labels stay put. Read as selected. Leave it out for a row that is no choice |
selection | { checked?: boolean; defaultChecked?: boolean; onCheckedChange?: (checked: boolean) => void } | — | A row of a list to pick several from: on iOS the selection circle leads the row and its content moves 40.67 in after it, as a list in edit mode; on Android the checkbox stands at the end. The whole row toggles it, and the circle is the row's one element for a screen reader, a checkbox named by the label |
trailing | ReactNode | — | A control at the end: a Switch, a Badge, an Input (on iOS a field fills the room after the label). A Switch or a Checkbox toggles on a press anywhere on a row without onPress |
action | ReactNode | — | A button of the row's own at its end, after trailing, beside the row's press (the App Store's Get): it keeps its own press, and a screen reader reaches it as an element of its own after the row's. Give it a Button or an IconButton |
error | ReactNode | — | An error under the row in the danger color: on iOS a line of its own with an exclamation mark, on Android under the label; announced when it appears |
menu | ReactElement | — | A Menu.Content the row opens: the row is the menu's one button, and its end draws More (iOS's ellipsis, Android's vertical dots) as a mark, not a second button; the menu stands at it, on iOS at its trailing edge, on Android under the row at its end. A trailing takes the More's place. A menu of options (items with checked) is a picker, as a Select at the row's end: iOS draws the menu picker's chevrons after the row's value, Android the value alone in the accent |
menuOpen | boolean | — | Whether the row's menu shows, when the app holds it; else the row holds its own |
onMenuOpenChange | (open: boolean) => void | — | Called when the row's menu opens or closes |
disclosure | boolean | onPress && !trailing && !action && !destructive | The chevron of a row that opens a page, on iOS. Android draws none |
onPress | () => void | — | Makes the row a button |
onLongPress | () => void | — | A touch and hold on the row (half a second), also a named action for screen readers. A control at the row's end that takes the row's focus (a Checkbox, a Switch, a RadioGroup choice) carries it too |
longPressLabel | string | — | The name of the touch and hold for screen readers |
disabled | boolean | false | Dims the row and takes no presses |
destructive | boolean | false | A row in red, as a destructive action |
accessibilityLabel | string | — | Name of the row for screen readers; defaults to the label and the value |
accessibilityHint | string | — | What a press does, read after the name ("Edit date of birth"); on a control at the row's end that takes the row's focus it goes to the control |
testID | string | — | Test id |