A text input with a leading search icon and a trailing clear button — the clear button only appears once there's a value to clear.
tsx
<SearchInput label="Search" />label
Examples
Controlled is the common case — a search field almost always needs to drive a filtered list or a query somewhere else on the page:
tsx
const [query, setQuery] = useState("");
<SearchInput
label="Search"
value={query}
onChange={(e) => setQuery(e.target.value)}
placeholder="Search components…"
/>;Clicking the clear button fires the same onChange with an empty value, so a single handler
covers both typing and clearing — there's no separate onClear to wire up.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| className | text | — | — |
| description | text | — | — |
| error | text | — | — |
| label | text | — | — |
| success | text | — | — |