Skip to content

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

RowHoldsLook
Row 1page controls: the location switcher (phone only), Back, the title, the view toggle, AddToolbar default: surface background (bg-background-surface), a 2px line under it (border-b-2 border-accessory-default)
Noteoptional, between row 1 and row 2: the “view only” note a location viewer sees on the cart page and on Cookingno line of its own; one 1px line under it (SubrowLine). See The note between row 1 and row 2
Row 2list controls: sort, sort direction, relations, filters, search, and Select at the endno background, no border (ItemListToolbar variant="row2")
Select allSelect mode only: the Select all shown checkboxno background, no border (SelectAllCheckbox)
Subrowsunder row 2: the filter row (with its status row), the search row, and in Select mode the select-all roweach starts with one 1px line above it (SubrowLine). See Subrows
Lineends the headerone 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.

RuleDetail
the lineh-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)
whereABOVE the subrow, never under it
the last subrowis followed by the header’s own line only. Two lines never touch
no subrow openrow 2, then the header’s line. No extra line
one subrow, two partsno 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
SubrowDrawn by
filters and their statusItemListToolbar
searchItemListToolbar
select allListHeaderRows, in front of its selectAll slot
the search row of CookingCookingControlBar
the filter row (with its status) and the search row of the onboarding items pickerTemplateItemsBrowser, 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.

RuleDetail
which notethe “view only” note (ReadOnlyNote, common.locationViewOnly) a location viewer sees on the cart page and on Cooking
above itrow 1’s own 2px line. Nothing else
under itONE SubrowLine, then row 2
the note itselfno border
in codepass 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

PageRow 1Row 2
Pantry list (/)switcher, view toggle, Addsort … search, Select
shelf, vendor, recipe viewswitcher, Back, title, settings linksort … search, Select
shopping cartswitcher, Back, vendor name, count, Cancel, Donesort … search
Settings › a shelf, vendor, recipe or tag › Itemsthe page’s own top barsort … search
Cookingswitcher, serving count, Cancel, Donesort, 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 isHow 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.

PartRule
the bar{count} selected, a spacer, Cancel, Edit. The count is a polite live region. Edit is off at 0 and above 200 picks
buttonstop 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 1hidden while the mode is on, with the switcher and Back. A location change ends Select mode anyway
row 2stays, so the person can filter, then select all shown
a narrow phonethe bar wraps to two lines. It never scrolls sideways and no button is cut off
leavingCancel, 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.

StateWhenA click
uncheckedno shown item is pickedpicks every shown item
mixed (a dash, aria-checked="mixed")some shown items are pickedpicks every shown item
checkedevery shown item is pickedunpicks 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:

  1. An open dialog or menu closes. Select mode stays.
  2. Text in the search field is cleared. Select mode stays.
  3. 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.