Skip to content
h v3.13.3
Search the docs
Find a component, section or page.

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/ui

Usage

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

search bindable string
The search text. Leave it out for no search.
searchPlaceholder string
Default "Search..."
searchLabel string
Default "Search"
The label of the narrow search button. Translate at the call site.
tabs readonly TabDef<Tab>[]
A strip of tabs, such as All, Open and Done.
tab bindable Tab
tabsLabel string
Default "Show"
views readonly (TabDef<View> & { icon: NonNullable<TabDef<View>["icon"]> })[]
How the page shows its records: a list, a board, a grid. Each one needs an icon.
view bindable View
viewLabel string
Default "View"
filters Snippet
Controls that stay on the row at every width, such as filter chips. They scroll sideways before they wrap.
actions Snippet
The primary action and its neighbours, pinned to the right edge.
class string
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