List
A vertical list of rows that each hold one record or setting: an optional leading mark, a title with a supporting line, trailing content and a chevron. grouped is one Card with a divider between rows; cards is one Card per row, the form a Table takes on a small screen. A row can be a link, a button or plain, and selectionMode turns every row into a checkbox.
Preview
Usage
When to use
- Show records on a small screen, where a Table would not fit: each row becomes a card.
- List settings rows, or the actions of a menu in a bottom Sheet.
- Let the user pick several rows, with a checkbox on each.
When not to use
- Compare columns of figures. Use Table, and let it scroll sideways.
- The main navigation of an app. Use Sidebar or BottomNav.
- A list of conversations with unread counts. Use ConversationList.
Platform support
What each platform has, from the spec. A selected platform is highlighted.
| Name | Web | iOS | Android | Note |
|---|---|---|---|---|
| variant | Yes | Yes | Yes | |
| label | Yes | Yes | Yes | |
| selectionMode | Yes | Yes | Yes | |
| leading | Yes | Yes | Yes | |
| title | Yes | Yes | Yes | |
| supporting | Yes | Yes | Yes | |
| trailing | Yes | Yes | Yes | |
| href | Yes | No | No | Only on web. Not generated for iOS and Android. |
| onPress | Yes | Yes | Yes | |
| selected | Yes | Yes | Yes | |
| onSelectedChange | Yes | Yes | Yes | |
| disabled | Yes | Yes | Yes | |
| chevron | Yes | Yes | Yes | |
| leadingActions | No | Yes | Yes | Only on iOS, Android. |
| trailingActions | No | Yes | Yes | Only on iOS, Android. |
Variants
variant
On List. grouped is one Card with a divider between rows. cards is one Card per row with spacing-sm between them, for records that were table rows.
Examples
Grouped
One Card with a divider between rows, for settings.
Cards
One Card per row, the form a Table takes on a small screen.
Records
Customer and status Badge on the first line, plan and MRR on the second.
Selection mode
Every row is a checkbox named by its title. Hold selected in your state and update it from onSelectedChange.
Do and don't
Do
- Use List for records on a small screen: a Table never ships on a phone, so its rows become cards.
- Put the name in title and the main figure in trailing, then the details and the status Badge in supporting.
- Use grouped for settings rows and for action menus in a bottom Sheet.
- Add chevron only to rows that open something.
Don't
- Do not use List to compare columns. Use Table and let it scroll sideways.
- Do not nest a button or link in trailing inside a row that is itself a link or button.
- Do not give a row a fixed height. It grows with a second line and never goes under the touch target.
Props
| Name | Type | Values | Default | Description |
|---|---|---|---|---|
| variant | enum | grouped | cards | grouped | On List. grouped is one Card with a divider between rows. cards is one Card per row with spacing-sm between them, for records that were table rows. |
| label required | string | - | - | On List: names the list for screen readers, such as Customers. |
| selectionMode | boolean | - | false | On List. Every row shows a checkbox named by its title. A press on a row toggles it, and href and onPress are ignored. |
| leading | node | - | - | On ListItem: an icon, an Avatar or another mark at the start. |
| title required | node | - | - | On ListItem: the main text, such as a customer name. |
| supporting | node | - | - | On ListItem: a second line under the title. |
| trailing | node | - | - | On ListItem: content at the end, such as a figure and a status Badge. |
| href | string | - | - | On ListItem. With it the row is a link. Only on web. Not generated for iOS and Android. |
| onPress | (event: React.MouseEvent<HTMLButtonElement>) => void | - | - | On ListItem. With it, and no href, the row is a button. |
| selected | boolean | - | false | On ListItem. In selection mode the checkbox is on. Otherwise the row is the current one: aria-current and the muted accent fill. |
| onSelectedChange | (selected: boolean) => void | - | - | On ListItem. Called with the next value when the row is pressed in selection mode. |
| disabled | boolean | - | false | On ListItem. The row takes no press, no link and no focus, and uses the disabled colors. |
| chevron | boolean | - | false | On ListItem. Shows the chevron at the end. Use it on rows that open another page or a sheet. Hidden in selection mode. |
| leadingActions | { label: string; icon: ReactNode; tone?: "default" | "danger"; onPress: () => void }[] | - | - | Native only, on ListItem: actions revealed by swiping toward the end. Not rendered on web. Only on iOS, Android. |
| trailingActions | { label: string; icon: ReactNode; tone?: "default" | "danger"; onPress: () => void }[] | - | - | Native only, on ListItem: actions revealed by swiping toward the start, such as Delete with tone danger. Not rendered on web. Only on iOS, Android. |
Slots
| Name | Required | Description |
|---|---|---|
| content | yes | The ListItem rows of the list. On native the app supplies them as the content closure. |
| leading | no | Optional mark at the start of a row. |
| title | yes | The main text of a row. |
| supporting | no | Optional second line. |
| trailing | no | Optional content at the end of a row. |
Anatomy
| Part | Description |
|---|---|
| root | The ul, named by label. With grouped it draws the Card box (surface, border, radius-container); with cards it is a column with spacing-sm between the rows. |
| listItem | One row inside its li: a link, a button or a plain div. At least size-target-min tall, it grows with a second line. With cards each row draws its own Card box; with grouped a Separator line above it divides it from the previous row. |
| separator | With grouped, the Separator line above every row but the first, in the border color. |
| leading | Optional slot at the start: an icon, an Avatar or a Checkbox. It keeps its own size and does not shrink. |
| title | The main text of the row, on one line, medium weight, cut with an ellipsis. |
| supporting | Optional second line under the title: a detail, a date or a plan, in secondary text. |
| trailing | Optional slot at the end: a value, a Badge or a Switch. It does not shrink and is aligned to the title line. |
| chevron | Optional Tabler chevron (16px) at the very end that says the row opens something. It points to the end of the reading direction. |
Accessibility
Role: list
| Keys | Action |
|---|---|
| Tab | Moves to the next row that is a link or a button, or to the next checkbox in selection mode. |
| Enter | Follows the focused link, or presses the focused button. |
| Space | Presses the focused button, or toggles the focused checkbox in selection mode. |
- The root is a ul named by label (aria-label) and every row is wrapped in an li, so a screen reader announces the list and the number of items.
- A row with href is a link and a row with onPress is a button. A row with neither is plain text in the li and takes no focus. Its whole content is the name, so title comes first in the reading order.
- In selection mode a row holds a checkbox (role checkbox, aria-checked) named by the row's title. A press anywhere on the row toggles it; href and onPress are not used in this mode.
- selected outside selection mode marks the current row with aria-current="true" and the muted accent fill. The fill is never the only sign: the title also steps to the on-muted text color.
- A disabled row has aria-disabled="true", no href and no press, and takes the disabled colors.
- The chevron and the leading mark are decorative. Name an icon-only leading mark through the title, not through the icon.
- Native only: leadingActions and trailingActions are swipe actions. Each one has a label that a screen reader reads as a custom action on the row, so a swipe is never the only way to reach it.
Install
npx werewolf-ui add listRun npx werewolf-ui init once in your app before adding components. Init sets up tokens, their CSS import and agent rules. Add installs this component and its dependencies while preserving your theme. See Installation for requirements and the alternative registry setup.