Columns control

Outside the canon

Which of a table's columns show, and in what order (2026-10-27, after ChartMogul's tables): the list toolbar's Columns button, just left of Sort (Toolbar columns_control). Its popover lists the columns in order; a checkbox shows or hides each, and a grip drags it up or down the list, which is its place left to right. The table's head does the same move directly: with Table onColumnMove, a header cell given a column_key shows a 28 × 12px tab hanging from its top edge on hover, and dragging it moves the column (the cell washes stone-100, a chip with the name follows the pointer, a 3px mustard bar marks the landing place, the table scrolls when the pointer nears either edge, Escape cancels). The popover is the way that also works on a touch screen; both work from the keyboard (arrow keys on a focused grip or tab, announced in a live region). A pinned column — a list's identifier, the link to the record — always shows and holds its end of the row: pinned "start" leads it, pinned "end" closes it (Transactions' identifier since 2026-10-28, Danielle: the statuses lead and the reference sits last). It is listed at that end of the popover, checked and disabled, with "Always shown" in the row (P8), and has no handle; a column dropped past the last movable one lands before an end-pinned column, never after it. Changes apply as they are made, so there is no Apply; Reset restores the defaults and is disabled while they hold. The trigger is the filter trigger's 32px outlined control, icon-only at every width with "Columns" in a Tooltip on hover and focus (2026-11-04, Danielle's review comment: "download and columns can be an icon and if you hover a word pops up with the title, to keep space small"; it had a label from sm, then from xl); the toolbar drops it where the list stacks (stack_below), since a stacked row has a fixed anatomy. State: useTableColumns(table, defs) in lib/use-table-columns.ts — order and visibility per table, remembered per browser (mock); in the app a per-user preference so it follows the person and paints on first render. Outside the canon vocabulary.

App: Ui::ColumnsControlComponent (suggested), the `popover` controller for the panel and a `table_columns` Stimulus controller (SortableJS for the drags) that hides and reorders cells by data-column key and PATCHes the user's preference

Popover open

#open

default_open (Lookbook only). The heading, a row per column in order — a grip and a checkbox for each, then the pinned one last with a lock and "Always shown", as Transactions' identifier closes its row — and a footer with how many show and Reset, disabled while nothing has changed. The list scrolls inside the panel when the window is short, so the footer stays on screen.

With its table

#with-table

The Columns button above a table whose head takes onColumnMove: the icon alone, "Columns" in a Tooltip on hover. Untick a column to hide it, tick Created By to show it. Hover a column head for the tab on its top edge and drag it sideways: the head cell washes stone-100, a chip with the column's name follows the pointer and a 3px mustard bar marks where it will land; Escape cancels. Or drag a row's grip in the popover, or focus a grip (or a head's tab) and use the arrow keys. Number is pinned to the end: listed last as Always shown, with no handle, and a column dropped at the end of the head lands before it. Changes are remembered in this browser; Reset puts the defaults back.

StatusDateCustomerAmountNumber
SucceededFeb 10, 2026Hillside Food Co-op$1,282.50R-PM1001
Partial RefundFeb 9, 2026Nolan's Bakery$3,890.50R-PM1002
SucceededFeb 9, 2026Broad Street Bistro$2,150.00R-PM1003

Props

NameTypeDefaultNotes
idstring—Required. The popover id
columnsColumnsControlColumn[]—Required. Every column in its current order, pinned ones at their ends: { key, label, visible, pinned?: "start" | "end" }
onToggle(key) => void—Required. Show or hide one
onMove(key, to_index) => void—Required. Move a column to an index among the unpinned columns
onReset() => void—Required. Restore the table's defaults
is_defaultboolean—Required. Nothing changed: Reset is disabled
default_openbooleanfalseLookbook only: start with the panel open
classNamestring—On the wrapper <div>
useTableColumns(table, defs)hook—lib/use-table-columns.ts. defs: { key, label, pinned?: "start" | "end", default_hidden? }[] in default order. Returns columns, visible_keys, toggle, move, moveBefore, reset, is_default. A column added after a choice was saved keeps its default visibility and lands after the column it follows by default
Table.onColumnMove(key, before_key | null) => void—Turns on the head's drag handles; pass useTableColumns' moveBefore
TableHeaderCell.column_keystring—Makes the cell a handle and a drop target; leave it off a pinned column
TableHeaderCell.column_labelstring—The name for the chip and the handle's label, where children are not plain text