Database
Filter & Sort Menus
“Filter by…” and “Sort by…” property pickers, plus the editors behind the filter and sort rule pills.
Usage
- Use
FilterMenuandSortMenuas the first step of adding a filter or sort: pick a property, then openFilterEditororSortEditor. - Order the properties the way people expect to scan them (title first, then frequently filtered ones).
- Use
PropertyPickerMenudirectly for other “pick a property” flows (group by, calculations). - Don’t use these menus outside a database; use
MenuorComboboxfor general choices.
Installation
Install the package (React 19):
Import the styles once, in your app entry or root layout:
Use it anywhere inside your app's <Theme> (see Installation):
Examples
Filter editor
Sort editor
Custom menu from the parts
Build other database pickers ("Group by…") from the same parts: DbMenuSearch on top, DbMenuItem rows in labelled groups, DbMenuRule between sections and useMenuKeys for ↑/↓ and Enter/Space.
Composition
API Reference
FilterMenu
PropertyPickerMenu with the "Filter by…" placeholder and the "Add advanced filter" footer. Based on <div> (except onSelect).
| Prop | Type | Default |
|---|---|---|
properties | Property[] | |
onSelect | (property: Property) => void | |
onAdvanced | () => void | |
highlightFirst | boolean | false |
autoFocus | boolean | false |
width | number | 290 |
SortMenu
PropertyPickerMenu with the "Sort by…" placeholder. Based on <div> (except onSelect).
| Prop | Type | Default |
|---|---|---|
properties | Property[] | |
onSelect | (property: Property) => void | |
highlightFirst | boolean | false |
autoFocus | boolean | false |
width | number | 290 |
PropertyPickerMenu
| Prop | Type | Default |
|---|---|---|
properties | Property[] | |
placeholder | string | |
onSelect | (property: Property) => void | |
footer | { label: string; onSelect?: () => void } | |
highlightFirst | boolean | false |
autoFocus | boolean | false |
width | number | 290 |
FilterEditor
| Prop | Type | Default |
|---|---|---|
property | Property | |
filter | Filter | |
onChange | (f: Filter) => void | |
onRemove | () => void |
SortEditor
| Prop | Type | Default |
|---|---|---|
properties | Property[] | |
sorts | Sort[] | |
onChange | (s: Sort[]) => void | |
onAdd | () => void |
DbMenuSearch
The 28px search field at the top of database menus, placed 12px in. An <input type="search">: all input props pass through; its accessible name defaults to the placeholder (without "…").
| Prop | Type | Default |
|---|---|---|
wrapperClassName | string |
DbMenuItem
A MenuRow made focusable for useMenuKeys: a button (or a switch when toggle is set) with tabIndex={-1}; focus draws the highlighted look. Same props as MenuRow.
| Prop | Type | Default |
|---|---|---|
children | ReactNode | |
icon | IconName | ReactNode | |
description | ReactNode | |
caption | ReactNode | |
shortcut | ReactNode | |
submenu | boolean | |
trailing | ReactNode | |
checked | boolean | |
toggle | boolean | |
onToggle | (next: boolean) => void | |
tone | 'default' | 'danger' | 'accent' | 'muted' | 'default' |
highlighted | boolean |
DbMenuRule
Inset hairline between database menu sections (12px from the edges).
| Prop | Type | Default |
|---|---|---|
className | string |
useMenuKeys
useMenuKeys(): (e: KeyboardEvent<HTMLElement>) => void. Attach to a menu surface's onKeyDown: ↑/↓ move focus across its DbMenuItems (wrapping), Enter/Space click the focused one.
| Prop | Type | Default |
|---|
SubmenuRow
Menu row that opens a flyout to its right ("Layout Table ›"). Extends MenuRowProps (without submenu / content).
| Prop | Type | Default |
|---|---|---|
content | ReactNode | ((close: () => void) => ReactNode) | |
value | ReactNode | |
width | number | 240 |
children | ReactNode | |
icon | IconName | ReactNode | |
description | ReactNode | |
caption | ReactNode | |
shortcut | ReactNode | |
trailing | ReactNode | |
checked | boolean | |
toggle | boolean | |
onToggle | (next: boolean) => void | |
tone | 'default' | 'danger' | 'accent' | 'muted' | 'default' |
highlighted | boolean |
Accessibility
- The search field takes focus with
autoFocus; Enter picks the first match. - Rows are focusable
DbMenuItems: ArrowUp/ArrowDown move, Enter/Space select (useMenuKeys). - Editors’ delete buttons are labelled "Delete filter" / "Remove sort".