Lists
RowList and ListRow, for a list of things with one title each.
Use RowList with ListRow for a list of things.
A table of columns is a DataTable, see Records.
Sizes
| Setting | Row height |
|---|---|
density="compact", the default | 30px |
density="comfortable" | 36px |
lines={2} or lines={3} | Rows with more text |
| On a phone | 44px for one line, 58px for two |
A row of two or three lines has its title at 13/20 and its secondary text at 12/16, with 6px vertical padding. The time ends the first line, and the state ends the second.
The parts of a row
In order:
icon(16px) orleading(anAvatar size="sm"), in a fixed 20px boxtitlesecondarystatus, oneStatemeta, a time or a count intext-3actionsorpersistentActions
actions are IconButton size="sm".
They show on hover, focus and selection.
On a phone or a touch screen they take no width, and are a left swipe and a long press menu away.
persistentActions are always shown, such as answer buttons.
leadingActions and trailingActions are swipe actions.
menu is the context menu.
Columns line up
The rows of a RowList share one grid, each row a subgrid.
Icons, titles, states, times and actions line up down the list.
The title keeps the width of the longest title, up to 40% of the row, before the trailing columns take theirs. The secondary text gives way first.
Row states
selectedis the inset fill,bg-4, 6px from the edge of the list.unreadbolds the title and puts a dot at the leading edge of the row, inside the fill. In a list that tracks it, passunread={false}on the read rows, so the column of the dot stays and nothing moves.muteddims the row.movable={false}pins a row in a list withonReorder.
No row has a grip or a delete button. You drag the row itself, and Delete is in its menu and on the Delete key.
Links and long lists
With href or onClick the whole row is one link or button.
RowList items={…} renders only the visible rows past 150 rows.
Give it a height.
Its rows then take the widest trailing cell seen so far for each column.
divided adds hairlines between rows of several lines.
Variants
density and variant belong to the list.
| Variant | Where |
|---|---|
inset | In a card, panel or inspector at any depth. Titles sit on the text edge of the container, and the fill is 6px from its edge |
inline | In a property value or a form. 28px rows on the edge of the content |
boxed | A group of its own |
Keys and gestures
The arrow keys, Home and End move between rows. The list is one tab stop.
With items and getKey a list can do more.
onReorder(from, to)moves rows. Drag the row itself past 4px, or on touch move it after the long press that opened its menu. Alt and an arrow key move it too. A line shows where it drops, and the list scrolls at its edges. The indices are those ofitems, so this works on long lists.selectablelets the person select rows. A click opens, Cmd or Ctrl and a click toggles, and Shift and a click selects a range. Shift and an arrow key extend it. Space, Cmd or Ctrl and A, and Escape work as usual. A bar at the foot shows only while something is selected, withbulkActions.onRemoveremoves rows, by the Delete key, Delete in the menu, or a swipe. Return an undo for a toast.onAddadds an add row.editingis the iOS edit mode: a selection circle, then the content.rowMenuis the context menu. It opens with a right click, the Menu key, Shift and F10, or a long press. The default items are Open, the row's actions, Rename and Delete.
On a row of a selection of several, the menu acts on the selection, with the bar's actions and "Delete 3". Any other row is selected alone first.
A row's onRename edits its title in place, by F2 or a double click.
A row's children nest under it as a tree.
Last updated on