Toolbar
The list-page toolbar row for a pane. Wide, search, tabs and the view switch sit inline. Narrower, tabs and views fold into a picker, then search into an icon, and the row never wraps.
A 720px pane: search, tabs and view sit on the row.
A 340px pane: the same row folded. Tabs and view open a picker, and search opens across the row.
Installation
pnpm add @heyramzi/uiUsage
import { Toolbar } from "@heyramzi/ui/components/toolbar";<Toolbar bind:search bind:tab bind:view {tabs} {views}>
{#snippet actions()}
<button type="button">New</button>
{/snippet}
</Toolbar>Keyboard and accessibility
| Key | Does |
|---|---|
| Tab | Moves to the next control. The controls are separate stops. |
| Space Enter | Picks a tab or view, or opens a menu. |
- In a narrow pane, the tab and view strips fold into dropdown menus named by tabsLabel and viewLabel, and the search folds into a button named by searchLabel.
- In a wide pane, the search box is named by searchLabel too, "Search" by default. ToolbarSearch on its own takes a label.
- It has no toolbar role, so the arrow keys don't move between its controls.
API reference
searchbindablestring- The search text. Leave it out for no search.
searchPlaceholderstring- Default
"Search..." searchLabelstring- Default
"Search" - The label of the narrow search button. Translate at the call site.
tabsreadonly TabDef<Tab>[]- A strip of tabs, such as All, Open and Done.
tabbindableTabtabsLabelstring- Default
"Show" viewsreadonly (TabDef<View> & { icon: NonNullable<TabDef<View>["icon"]> })[]- How the page shows its records: a list, a board, a grid. Each one needs an icon.
viewbindableViewviewLabelstring- Default
"View" filtersSnippet- Controls that stay on the row at every width, such as filter chips. They scroll sideways before they wrap.
actionsSnippet- The primary action and its neighbours, pinned to the right edge.
classstring
| Prop | Type | Default |
|---|---|---|
search bindable The search text. Leave it out for no search. | string | |
searchPlaceholder | string | "Search..." |
searchLabel The label of the narrow search button. Translate at the call site. | string | "Search" |
tabs A strip of tabs, such as All, Open and Done. | readonly TabDef<Tab>[] | |
tab bindable | Tab | |
tabsLabel | string | "Show" |
views How the page shows its records: a list, a board, a grid. Each one needs an icon. | readonly (TabDef<View> & { icon: NonNullable<TabDef<View>["icon"]> })[] | |
view bindable | View | |
viewLabel | string | "View" |
filters Controls that stay on the row at every width, such as filter chips. They scroll sideways before they wrap. | Snippet | |
actions The primary action and its neighbours, pinned to the right edge. | Snippet | |
class | string |