

Every state


default


focus


results


scope


scope-focus


loading


no-results
Props
| Prop | Type | Default | What it does |
|---|---|---|---|
| id | string | "command" | Id prefix; make it unique on the page. |
| label | string | "Search the app" | Accessible name of the bar and of its field. |
| placeholder | string | "Search pages, products and people…" | Placeholder text. |
| scopes | SearchBoxCommandScope[] | [ { value: "all", label: "All" }, { value: "pages", label: "Pages" }, { value: "products", label: "Products" }, { val… | The scope chips, in order; the first is selected at the start. |
| suggestions | SearchBoxCommandGroup[] | [ { heading: "Suggested", items: [ { id: "s-new", label: "New invoice", href: "/app/invoices/new", icon: "file-text",… | Groups shown while the field is empty (suggested pages, recent items). |
| search | (query: string, scope: string) => Promise<SearchBoxCommandGroup[]> | async (query, scope) => { await wait(200) const q = query.trim().toLowerCase() const hits = INDEX.filter((x) => (scop… | Finds the groups for what was typed in a scope; the default searches a small local list after a short wait. |
| defaultQuery | string | – | Starting text in the field. |
| defaultScope | string | – | Starting scope (a scope's value). |
| shortcut | string[] | null | ["⌘", "K"] | The shortcut that opens the bar, shown as a hint ("⌘ K"). Null: no hint. |
| onSelect | (item: SearchBoxCommandItem) => void | – | Called with the item when one is opened. Left out: the browser goes to its href. |
| onClose | () => void | – | Called by Escape on an empty field, so the dialog around the bar can close. |
| className | string | – | Extra classes on the outer element. |
More search boxes
All 6search-box-01 is in UI ProGet UI Pro, €199


