The bar along the top of an app
Most app screens keep the same few things above the page: the search, a few icon controls, the AI button and the page's primary action. AppToolbar lays them out in one order every time: the search, space, the icon controls, the AI button and the primary action. An icon control can open a panel of its own, such as the notifications here. It folds in steps as the bar narrows. Seat it in AppLayout's toolbar slot and it stays pinned while the page scrolls.
Default
Primary action
The page's one primary action goes last, after the AI button: a primary button with a leading icon, the same height as the AI button beside it.
Compact
The compact size sets every control at the 32px row height, for a denser app. The search, the icon controls, the AI button and the primary action always share one height, at either size.
Narrowing
The bar measures itself, not the screen, so beside an open rail or chat it folds the same way it does on a phone. The search keeps a usable width until there is no room for it. Then it folds in three steps: the AI button and the primary action to their icons, the search to its icon, and the icon controls after the first into a More menu.
Alternatives
- Use Table toolbar instead when the bar sits over a table and holds its search, filters and view settings.
- Use Toolbar instead when the controls act on a canvas or a view and sit together in one pill.
Props
Read from the same JSDoc that ships in the package's types. A required prop is marked with an asterisk.
| Prop | Type | Default | Description |
|---|---|---|---|
onSearch | MouseEventHandler<HTMLButtonElement> | Opens the app's search, usually a CommandPalette. When given, the bar
starts with a search field, never narrower than a usable field, folded
to its icon when the bar is narrow. | |
searchLabel | string | 'Search or ask anything' | The search field's prompt and accessible name. Default "Search or ask anything". |
searchKeys | string | 'mod+k' | The shortcut the search field shows, in the shortcut grammar. The
palette owns the key itself; this only draws it. |
searchGlass | boolean | false | Frosts the search field, in both its forms, for a bar that rides over a
busy ground (a map or a shader under the top of the page), so its prompt
reads over it. The other controls are ghost buttons and draw no fill. |
actions | AppToolbarAction[] | [] | The icon controls at the end, borderless: notifications, a calendar,
help, settings. On a narrow bar every one after the first moves into a
More menu, except those that open a panel or are links. |
onChat | MouseEventHandler<HTMLButtonElement> | Opens the app's AI chat. When given, an AiButton follows the icon
controls, folded to its icon when the bar is narrow. | |
chatLabel | string | 'Ask AI' | The AI chat button's label. Default "Ask AI". |
chatState | AgentStatusState | 'idle' | What the agent behind the AI button is doing, in AgentStatus's
vocabulary, so the button can show it working. |
chatExpanded | boolean | Whether the chat the AI button opens is open now, announced as the button's expanded state. | |
primaryAction | AppToolbarPrimaryAction | The page's primary action, last in the row: a primary Button with a
leading icon, the AI button's size, folded to its icon when the bar is
narrow. | |
size | "default" | "compact" | 'default' | The size of every control in the bar, on the row-control scale:
`default` is 40px, `compact` 32px. The search, the icon controls, the
AI button and the primary action always share one height. |
linkComponent | LinkComponent | The component the actions' links render with, such as Next.js's `Link`,
so they navigate through the app's router. Wins over a LinkProvider's;
a plain `<a>` when neither is set. | |
toolbarLabel | string | 'App toolbar' | The bar's accessible name. Default "App toolbar". |
moreLabel | string | 'More' | The More menu button's name, shown when the bar is narrow. Default "More". |
className | string | '' | Additional CSS classes on the bar |
Keys
Tab moves through its controls in order; each control, the More menu among them, keeps its own keys. Those keys belong to the platform, so no test of this library presses them.
// From the npm package
import { AppToolbar } from 'rift-ds/components/AppToolbar/AppToolbar';
// Or as source you own, via the shadcn CLI
npx shadcn@latest add https://rift-ds.com/r/app-toolbar.json18.8 kB gzipped, with everything it imports. Peer dependencies are not counted.
For agents: the props, their allowed values and defaults, and the tested keys, as markdown or as a JSON schema.