List Toolbars
Every item list has the same header: row 1 for the page, row 2 for the list, then one thin line. A toolbar never scrolls away with the list.
The shopping cart page is the model. The Pantry list, the shelf, vendor and recipe views, the Settings item tabs and Cooking follow it. The onboarding pickers follow the same line rules.
The two rows
| Row | Holds | Look |
|---|---|---|
| Row 1 | page controls: the location switcher (phone only), Back, the title, the view toggle, Add | Toolbar default: surface background (bg-background-surface), a 2px line under it (border-b-2 border-accessory-default) |
| Note | optional, between row 1 and row 2: the “view only” note a location viewer sees on the cart page and on Cooking | no line of its own; one 1px line under it (SubrowLine). See The note between row 1 and row 2 |
| Row 2 | list controls: sort, sort direction, relations, filters, search, and Select at the end | no background, no border (ItemListToolbar variant="row2") |
| Select all | Select mode only: the Select all shown checkbox | no background, no border (SelectAllCheckbox) |
| Subrows | under row 2: the filter row (with its status row), the search row, and in Select mode the select-all row | each starts with one 1px line above it (SubrowLine). See Subrows |
| Line | ends the header | one 1px line (h-px bg-accessory-default), after row 2, its filter and search rows, and the select-all row |
- The rows are the same at every width. On a phone row 2 holds at most six icon buttons, which fit at 320 px.
- On desktop the location switcher is in the sidebar, so row 1 shows its copy only below
lg(lg:hidden). - The DOM order is the visual order. Tab goes through row 1, then row 2.
Subrows
Every subrow under row 2 starts with one 1px line. A subrow is a row that opens under row 2: the filter row, the search row, and the select-all row of Select mode.
| Rule | Detail |
|---|---|
| the line | h-px bg-accessory-default, the same token and width as the line that ends the header. In code: SubrowLine (apps/web/src/components/shared/SubrowLine) |
| where | ABOVE the subrow, never under it |
| the last subrow | is followed by the header’s own line only. Two lines never touch |
| no subrow open | row 2, then the header’s line. No extra line |
| one subrow, two parts | no line inside. The “Showing x of y” status belongs to the filter row, and it keeps the line when the filters are closed but a filter is still on. The read-only note under the search field belongs to the search row |
| Subrow | Drawn by |
|---|---|
| filters and their status | ItemListToolbar |
| search | ItemListToolbar |
| select all | ListHeaderRows, in front of its selectAll slot |
| the search row of Cooking | CookingControlBar |
| the filter row (with its status) and the search row of the onboarding items picker | TemplateItemsBrowser, in the same order as ItemListToolbar: filters and status first, then search |
| the status row of the onboarding vendors picker (its search is in row 2) | TemplateVendorsBrowser |
The note between row 1 and row 2
A note between row 1 and row 2 gets one 1px line under it, and none above it. Row 1 already ends with its own 2px line, so a line above the note would touch it.
| Rule | Detail |
|---|---|
| which note | the “view only” note (ReadOnlyNote, common.locationViewOnly) a location viewer sees on the cart page and on Cooking |
| above it | row 1’s own 2px line. Nothing else |
| under it | ONE SubrowLine, then row 2 |
| the note itself | no border |
| in code | pass it as note to ListHeaderRows. Do not put it in row2 |
Never draw a subrow line by hand in a page. Use the shared components, so every list looks the same.
What goes in each row
| Page | Row 1 | Row 2 |
|---|---|---|
Pantry list (/) | switcher, view toggle, Add | sort … search, Select |
| shelf, vendor, recipe view | switcher, Back, title, settings link | sort … search, Select |
| shopping cart | switcher, Back, vendor name, count, Cancel, Done | sort … search |
| Settings › a shelf, vendor, recipe or tag › Items | the page’s own top bar | sort … search |
| Cooking | switcher, serving count, Cancel, Done | sort, direction, expand all … search (CookingControlBar), in ListHeaderRows, with the same subrow and note rules |
In code
Use ListHeaderRows (apps/web/src/components/shared/ListHeaderRows). Do not build the rows by hand.
<div className="h-[100cqh] grid grid-rows-[auto_1fr]"> <ListHeaderRows row1={ <> <LocationSwitcher className="lg:hidden" /> <ViewToggle current="list" onChange={…} /> <span className="flex-1" /> <Button size="icon" aria-label="Add item" icon={<Plus />} /> </> } selectBar={bulk.active ? <SelectModeBar … /> : undefined} selectAll={ bulk.active ? ( <SelectAllCheckbox {...bulk.selectAllProps(shownIds)} /> ) : undefined } row2={ <ItemListToolbar variant="row2" … > <SelectModeButton ref={bulk.selectButtonRef} … /> </ItemListToolbar> } /> <div className="overflow-y-auto">{/* the list */}</div></div>Toolbars never scroll away
The header stays on screen while the list scrolls. There are two ways:
| Where the list is | How the header stays |
|---|---|
| the page owns its scroll area (Pantry, the views, the cart) | put ListHeaderRows in the auto row of a grid-rows-[auto_1fr] page. The list is the 1fr row, with overflow-y-auto. The line is outside the scroll area |
the list is inside a scroll area the page does not own (the Settings item tabs, inside LayoutInnerPages) | pass sticky. The rows get sticky top-0 z-10 bg-background-base, so the list scrolls under them |
<ListHeaderRows sticky row2={<ItemListToolbar variant="row2" … />}/>Select mode
In Select mode the Select mode bar takes the place of row 1. Row 2 stays. A select-all checkbox row sits under row 2.
| Part | Rule |
|---|---|
| the bar | {count} selected, a spacer, Cancel, Edit. The count is a polite live region. Edit is off at 0 and above 200 picks |
| buttons | top bar actions: an icon with a name on a phone (Cancel X, Edit Pencil), icon and text from lg up. See Button › Top bar actions on a phone. Cancel is the red ghost button (destructive-ghost), like every top bar Cancel: Button › Top bar Cancel |
| row 1 | hidden while the mode is on, with the switcher and Back. A location change ends Select mode anyway |
| row 2 | stays, so the person can filter, then select all shown |
| a narrow phone | the bar wraps to two lines. It never scrolls sideways and no button is cut off |
| leaving | Cancel, the Select toggle in row 2, or Esc |
The select-all checkbox
One checkbox, Select all shown, in its own row under row 2. It is part of the header, so it stays on screen while the list scrolls. It is a subrow, so one 1px line sits above it, like the filter and search rows (see Subrows). ListHeaderRows draws that line.
| State | When | A click |
|---|---|---|
| unchecked | no shown item is picked | picks every shown item |
mixed (a dash, aria-checked="mixed") | some shown items are picked | picks every shown item |
| checked | every shown item is picked | unpicks every shown item |
| off (disabled) | the list shows no item (a search or a filter) | nothing |
- “Shown” means the rows the list shows now, after search and filters, with the “Inactive here” rows. Never the search tail.
- Picks that are not shown stay in every case.
- The checkbox lines up with the item checkboxes: 16 px from the list edge, and the label starts where the card text starts (
px-4,gap-6). - It can pick more than 200 items. Edit is then off, with a note.
Esc
Esc goes to the innermost thing first:
- An open dialog or menu closes. Select mode stays.
- Text in the search field is cleared. Select mode stays.
- Otherwise Select mode ends.
After Esc or Cancel the focus goes to the Select toggle in row 2.
In code: usePantryBulkEdit listens for keydown on document while the mode is on. It ends the mode only when event.defaultPrevented is false. Radix dialogs and menus, and the search field when it clears text, call preventDefault on the Escape they use. An Escape that ends an input method composition (isComposing) is ignored.