Skip to content
Command bar, light
Light
Command bar, dark
Dark

Every state

  • Command bar, default, light
    Command bar, default, dark

    default

  • Command bar, focus, light
    Command bar, focus, dark

    focus

  • Command bar, results, light
    Command bar, results, dark

    results

  • Command bar, scope, light
    Command bar, scope, dark

    scope

  • Command bar, scope-focus, light
    Command bar, scope-focus, dark

    scope-focus

  • Command bar, loading, light
    Command bar, loading, dark

    loading

  • Command bar, no-results, light
    Command bar, no-results, dark

    no-results

Props

PropTypeDefaultWhat it does
idstring"command"Id prefix; make it unique on the page.
labelstring"Search the app"Accessible name of the bar and of its field.
placeholderstring"Search pages, products and people…"Placeholder text.
scopesSearchBoxCommandScope[][ { 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.
suggestionsSearchBoxCommandGroup[][ { 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.
defaultQuerystring–Starting text in the field.
defaultScopestring–Starting scope (a scope's value).
shortcutstring[] | 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.
classNamestring–Extra classes on the outer element.

More search boxes

All 6
search-box-01 is in UI ProGet UI Pro, €199

Preview

Open the page
In UI Pro: get it, €199 once

With every block and theme. 400+ buyers since 2020. Plans