Import Search Field and compose its parts.
search-field.tsx
SearchField
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| rounded | "default""full" | "default" | |
| size | "default""lg""sm""xs" | "default" | |
| variant | "dashed""default" | "default" | |
| value | string | — | The text, when the parent owns it. |
| default | string | — | The first text, when the field owns it. Default "". |
| on | — | Each change of the text, at once (each key, a clear). | |
| on | — | Run the search: on Enter, on a clear (with ""), and after debounce ms of no typing. | |
| on | — | The text was cleared (the clear button, or Escape with text). | |
| debounce | number | — | Ms of no typing before onSearch runs. undefined (the default): typing does not search, only Enter and a clear do. 0: each change searches. |
| shortcut | false"/""mod+k" | false | The key that focuses and selects the field from anywhere. Default false (none). |
| class | string | — | Classes of the frame (the InputGroup), for its width. |
| busy | boolean | false | The field waits for results: the spinner takes the place of the search icon, and the input is aria-busy. |
| labels | — | The words (SEARCH_FIELD_LABELS). Keep the object stable. | |
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
| Escape | Clears the text. |
|---|---|
| Enter | Runs onSearch at once. |
| /orMod K | Moves the focus to the field, when you set shortcut. |
- Animated Close IconA cross for Close and Dismiss buttons. It wiggles once when you hover or focus the button.
- Input GroupOne frame around an input or a text area and the parts next to it: icons, text, key hints, and buttons.
- KbdShows a key or a shortcut in text, such as a search hint, a shortcut in a menu, or a key in help text.
- SpinnerA small ring that turns while something loads and you cannot say how long it takes. It comes in 12, 16, and 24px and takes the color of the text.
- CommandPick Command for a search field over a list of commands, such as a command palette.
- AutocompletePick Autocomplete when the field must suggest values in a popup while people type.
Built with
Installs with Search Field
- Components
- Input Group,Kbd,Spinner









