List page
A toolbar with search and filters over a list and detail split.
Brightwell Legal
Contract workflowq-2041Ramzi
Installation
pnpm add @heyramzi/uiUsage
import {
DetailHeader,
DetailPanel,
DetailRow,
DetailStack,
EmptyState,
FilterItem,
FilterPopover,
filterSectionClass,
ListPageShell,
MasterDetail,
RailBody,
RailHead,
RailRow,
ToolbarSearch,
} from "@heyramzi/ui/components/list-page";<ListPageShell>
{#snippet content()}
<MasterDetail>
{#snippet rail()}
<RailBody>
{#each quotes as quote (quote.id)}
<RailRow title={quote.client} onclick={() => (selectedId = quote.id)} />
{/each}
</RailBody>
{/snippet}
{#snippet detail()}
<DetailHeader title={selected.client} />
{/snippet}
</MasterDetail>
{/snippet}
</ListPageShell>Keyboard and accessibility
| Key | Does |
|---|---|
| Tab | Moves through the toolbar, the rows, then the open record. |
| Space Enter | On a row, opens its record. |
| Arrow Down Arrow Up | In a filter menu, moves through its options. Space or Enter checks one and the menu stays open. |
| Esc | Closes a filter menu and returns focus to its button. |
| Arrow Down Arrow Up Home End | In a GroupedList, moves between the group headers. Space or Enter folds or unfolds one. |
- Rows are buttons, and the open one reports itself as current.
- A filter button opens a menu, and each option reports checked.
- A GroupedList header reports open or closed and points at the rows it folds.
- The filter tabs are a named group of radio buttons. Arrows move between them, and the picked one reports checked.
- The search field has only its placeholder for a name.
- Under 1024px wide, the list and the record take turns. Picking a row moves focus into the record, and the back button returns it to that row.
- With reduced motion on, the list-to-record slide doesn't play.
API reference
ListPageShell
isEmptyboolean- Default
false emptyStateEmptyConfighideToolbarWhenEmptyboolean- Default
false maxWidthstring | false- Default
"1600px" fillHeightboolean- Default
false containerClassstringtoolbarClassstringtabsSnippetsearchSnippetfiltersSnippetrightActionsSnippetsummarySnippetcontentSnippetemptySnippetextraSnippetsearchLabelstring- Default
"Search" - The folded search icon's name, on a toolbar too narrow for the field. Translate at the call site.
closeSearchLabelstring- Default
"Close search" - The close button's name once the folded search is open.
| Prop | Type | Default |
|---|---|---|
isEmpty | boolean | false |
emptyState | EmptyConfig | |
hideToolbarWhenEmpty | boolean | false |
maxWidth | string | false | "1600px" |
fillHeight | boolean | false |
containerClass | string | |
toolbarClass | string | |
tabs | Snippet | |
search | Snippet | |
filters | Snippet | |
rightActions | Snippet | |
summary | Snippet | |
content | Snippet | |
empty | Snippet | |
extra | Snippet | |
searchLabel The folded search icon's name, on a toolbar too narrow for the field. Translate at the call site. | string | "Search" |
closeSearchLabel The close button's name once the folded search is open. | string | "Close search" |
ToolbarSearch
valuebindablestring- Default
"" placeholderstring- Default
"Search..." labelstring- Default
"Search" - The box's accessible name. A placeholder isn't one, and it goes away once you type.
size"sm" | "default"- Default
"default" classstring
| Prop | Type | Default |
|---|---|---|
value bindable | string | "" |
placeholder | string | "Search..." |
label The box's accessible name. A placeholder isn't one, and it goes away once you type. | string | "Search" |
size | "sm" | "default" | "default" |
class | string |
FilterPopover
labelrequiredstringiconPhosphorIcon- Default
DefaultFunnelIcon countnumber- Default
0 activebooleanonClear() => voidalign"start" | "center" | "end"- Default
"start" width`w-${string}`- Default
"w-52" openbindableboolean- Default
false clearLabelstring- Default
"Clear" triggerClassstringcontentClassstringchildrenrequiredSnippettrailingSnippet
| Prop | Type | Default |
|---|---|---|
label required | string | |
icon | PhosphorIcon | DefaultFunnelIcon |
count | number | 0 |
active | boolean | |
onClear | () => void | |
align | "start" | "center" | "end" | "start" |
width | `w-${string}` | "w-52" |
open bindable | boolean | false |
clearLabel | string | "Clear" |
triggerClass | string | |
contentClass | string | |
children required | Snippet | |
trailing | Snippet |
FilterItem
checkedrequiredbooleanonclickrequired() => voidvariant"checkbox" | "radio"- Default
"checkbox" childrenrequiredSnippet
| Prop | Type | Default |
|---|---|---|
checked required | boolean | |
onclick required | () => void | |
variant | "checkbox" | "radio" | "checkbox" |
children required | Snippet |
MasterDetail
railrequiredSnippetdetailrequiredSnippetbannerSnippetrailWidthstring- Default
"minmax(260px, 320px)" stackBelow"lg" | "xl"- Default
"lg" backLabelstring- Default
"Back to the list" panebindable"rail" | "detail"- Default
"rail" gapboolean- Default
true padboolean- Default
true railClassstringdetailClassstringclassstring
| Prop | Type | Default |
|---|---|---|
rail required | Snippet | |
detail required | Snippet | |
banner | Snippet | |
railWidth | string | "minmax(260px, 320px)" |
stackBelow | "lg" | "xl" | "lg" |
backLabel | string | "Back to the list" |
pane bindable | "rail" | "detail" | "rail" |
gap | boolean | true |
pad | boolean | true |
railClass | string | |
detailClass | string | |
class | string |
RailHead
labelstringactionSnippetchildrenSnippetclassstring
| Prop | Type | Default |
|---|---|---|
label | string | |
action | Snippet | |
children | Snippet | |
class | string |
RailBody
childrenrequiredSnippetclassstring
| Prop | Type | Default |
|---|---|---|
children required | Snippet | |
class | string |
RailRow
titlerequiredstringselectedboolean- Default
false onclickrequired() => voidleadingSnippettrailingSnippetpreviewstring | nullmetaArray<string | null | undefined | false>metaTruncate"first" | "last"- Default
"first" metaTrailSnippetactionsSnippettitleLines1 | 2- Default
1 classstring
| Prop | Type | Default |
|---|---|---|
title required | string | |
selected | boolean | false |
onclick required | () => void | |
leading | Snippet | |
trailing | Snippet | |
preview | string | null | |
meta | Array<string | null | undefined | false> | |
metaTruncate | "first" | "last" | "first" |
metaTrail | Snippet | |
actions | Snippet | |
titleLines | 1 | 2 | 1 |
class | string |
DetailStack
fillboolean- Default
false childrenrequiredSnippetclassstring
| Prop | Type | Default |
|---|---|---|
fill | boolean | false |
children required | Snippet | |
class | string |
DetailHeader
titlerequiredstringbadgeSnippetleadingSnippetmetaArray<string | null | undefined | false>notestring | nullactionsSnippetcornerSnippetchildrenSnippetclassstring
| Prop | Type | Default |
|---|---|---|
title required | string | |
badge | Snippet | |
leading | Snippet | |
meta | Array<string | null | undefined | false> | |
note | string | null | |
actions | Snippet | |
corner | Snippet | |
children | Snippet | |
class | string |
DetailPanel
labelstring- What this panel is, drawn as the app's one panel label. No label, no actions: no header.
labelIconPhosphorIconlabelLeadSnippet- A mark the icon set lacks (a platform logo), drawn ahead of the label at the same size.
sublabelstring- A line under the label, for the scope a number was measured over.
hintstring- A row count, total or freshness stamp. A prop, not an action, because hand-placed hints ended up at three type sizes on one screen.
actionsSnippet- Controls that act on this panel. Pinned right, after the hint.
padboolean- Default
true - Off for a body that supplies its own padding: a table, a media grid, a full-bleed list.
scrollboolean- Default
false - The body scrolls sideways rather than squeezing, for a table wider than the window.
growboolean- Default
false - Takes the height the panels above it left, inside a `fill` stack. One per stack.
childrenrequiredSnippetclassstringbodyClassstring
| Prop | Type | Default |
|---|---|---|
label What this panel is, drawn as the app's one panel label. No label, no actions: no header. | string | |
labelIcon | PhosphorIcon | |
labelLead A mark the icon set lacks (a platform logo), drawn ahead of the label at the same size. | Snippet | |
sublabel A line under the label, for the scope a number was measured over. | string | |
hint A row count, total or freshness stamp. A prop, not an action, because hand-placed hints ended up at three type sizes on one screen. | string | |
actions Controls that act on this panel. Pinned right, after the hint. | Snippet | |
pad Off for a body that supplies its own padding: a table, a media grid, a full-bleed list. | boolean | true |
scroll The body scrolls sideways rather than squeezing, for a table wider than the window. | boolean | false |
grow Takes the height the panels above it left, inside a `fill` stack. One per stack. | boolean | false |
children required | Snippet | |
class | string | |
bodyClass | string |
DetailRow
mutedboolean- Default
false childrenrequiredSnippetclassstring
| Prop | Type | Default |
|---|---|---|
muted | boolean | false |
children required | Snippet | |
class | string |
EmptyState
iconPhosphorIconiconWeight"bold" | "duotone" | "fill" | "light" | "thin" | "regular"iconClassstring- Replaces the muted colour of a bare icon. Ignored by the tile, which stays foreground.
titlerequiredstringdescriptionstringactionLabelstringactionHrefstringonAction() => voidactionsSnippet- Several ways out, drawn in one row after the single action.
surface"plain" | "card" | "dashed"- Default
"plain" - `card` fills the white panel; `dashed` frames a whole dashboard section.
size"default" | "sm"- Default
"default" - `sm` fits a 280px rail: a bare icon and one line of small type.
classstring
| Prop | Type | Default |
|---|---|---|
icon | PhosphorIcon | |
iconWeight | "bold" | "duotone" | "fill" | "light" | "thin" | "regular" | |
iconClass Replaces the muted colour of a bare icon. Ignored by the tile, which stays foreground. | string | |
title required | string | |
description | string | |
actionLabel | string | |
actionHref | string | |
onAction | () => void | |
actions Several ways out, drawn in one row after the single action. | Snippet | |
surface `card` fills the white panel; `dashed` frames a whole dashboard section. | "plain" | "card" | "dashed" | "plain" |
size `sm` fits a 280px rail: a bare icon and one line of small type. | "default" | "sm" | "default" |
class | string |
PrevNext
idsrequiredreadonly string[]- Ids in the order the list shows them.
currentrequiredstring | null | undefinedonSelectrequired(id: string) => voidpreviousLabelstring- Default
"Previous" nextLabelstring- Default
"Next" keysboolean- Default
true - Off when two steppers share a page, so one key press moves one list.
classstring
| Prop | Type | Default |
|---|---|---|
ids required Ids in the order the list shows them. | readonly string[] | |
current required | string | null | undefined | |
onSelect required | (id: string) => void | |
previousLabel | string | "Previous" |
nextLabel | string | "Next" |
keys Off when two steppers share a page, so one key press moves one list. | boolean | true |
class | string |
NoticeBar
toneTone- Default
"destructive" iconPhosphorIconactionsSnippetchildrenrequiredSnippetclassstring
| Prop | Type | Default |
|---|---|---|
tone | Tone | "destructive" |
icon | PhosphorIcon | |
actions | Snippet | |
children required | Snippet | |
class | string |
GroupedList
groupsrequiredTGroup[]getKeyrequired(group: TGroup) => stringdefaultCollapsedstring[]- Default
[] onCollapsedChange(keys: string[]) => void- WHY: a page that drives its own keyboard cursor has to know which rows are on screen, and the collapsed set is the only thing that says so.
headerrequiredSnippet<[TGroup, { collapsed: boolean }]>actionsSnippet<[TGroup]>- Controls beside the header, outside its toggle button so a click on one doesn't collapse the group. Shown on hover of the header row.
rowsrequiredSnippet<[TGroup]>getCount(group: TGroup) => number- A count beside the header, in a small pill. Leave it out when the header draws its own.
onAdd(group: TGroup) => void- Shows an add button at the end of the header row.
addLabelstring- Default
"Add" - The add button's accessible name.
classstringonGroupDragOver(e: DragEvent, group: TGroup) => voidonGroupDragLeave(e: DragEvent) => voidonGroupDrop(e: DragEvent, group: TGroup) => void
| Prop | Type | Default |
|---|---|---|
groups required | TGroup[] | |
getKey required | (group: TGroup) => string | |
defaultCollapsed | string[] | [] |
onCollapsedChange WHY: a page that drives its own keyboard cursor has to know which rows are on screen, and the collapsed set is the only thing that says so. | (keys: string[]) => void | |
header required | Snippet<[TGroup, { collapsed: boolean }]> | |
actions Controls beside the header, outside its toggle button so a click on one doesn't collapse the group. Shown on hover of the header row. | Snippet<[TGroup]> | |
rows required | Snippet<[TGroup]> | |
getCount A count beside the header, in a small pill. Leave it out when the header draws its own. | (group: TGroup) => number | |
onAdd Shows an add button at the end of the header row. | (group: TGroup) => void | |
addLabel The add button's accessible name. | string | "Add" |
class | string | |
onGroupDragOver | (e: DragEvent, group: TGroup) => void | |
onGroupDragLeave | (e: DragEvent) => void | |
onGroupDrop | (e: DragEvent, group: TGroup) => void |