parts | ComponentPartsOf<{ Button: typeof Button }> | — | parts={{ Button: { size: "md" } }} | Configure the internally generated Clear button. Explicit child content does not consume this default configuration. |
variant | "gray" | "outline" | "gray" | variant="gray" | Search box appearance variant. |
gap | number | — | gap={42} | Inherited Frame gap token index. Omit it to retain the preferred component gap; explicit values override that preference. Effective graphics/text spacing remains at least 4 CSS px, including zero, root-font scaling and gap scaling. |
value | string | number | — | bind:value={query} | Current search text or display value. |
placeholder | string | — | placeholder="Search…" | Placeholder text. When omitted, searchBox.placeholder provides the localized placeholder (“Search” in en-US). An explicit empty string is preserved. |
open | boolean | false | bind:open={open} | Whether the popup is open; supports bind:open. |
disabled | boolean | false | disabled | Disable the trigger. |
readonly | boolean | false | readonly | Make the trigger read-only so it does not open the popup. |
showSearchIcon | boolean | true | showSearchIcon | Whether to render the default search icon. |
collapseBelow | number | — | collapseBelow={42} | At or below this component-width threshold in pixels, retain only the leading search icon. Omit to disable collapsing. |
clearable | boolean | true | clearable | Whether to show a Clear button when value is present. |
children | Snippet | — | <SearchBox><Kbd as="trailing" variant="solid" style="background-color: var(--surface-3);">⌘K</Kbd></SearchBox> | Additional leading or trailing content, such as Kbd. |
onOpenChange | (open: boolean) => void | — | onOpenChange={(next) => open = next} | Callback when the open state changes. |
onClear | () => void | — | onClear={() => message = "Search cleared"} | Callback when the value is cleared. |
onclick | (event: MouseEvent) => void | — | onclick={(event) => console.log(event.type)} | Called after clicking the entry with the original MouseEvent. When enabled and not readonly, SearchBox opens first; the callback cannot undo that opening. |
onkeydown | (event: KeyboardEvent) => void | — | onkeydown={(event) => console.log(event.key)} | Called with the original KeyboardEvent after Escape closes or Enter/Space opens the popup. It cannot undo a state change that already occurred. |
| No data |