Search
A field for finding content by keyword.
- Status
- ReadyBuild day 14 of 21
- Code
- In React
- Role
- Form
Usage
This demo is live, and the code below it is the same code, imports included. The component lives in src/ui of this repository and is not published to npm yet.
Pastes as editable layers. Shadows are not exported.
import { useState } from "react";
import { SearchField, type SearchFieldType } from "@/ui";
const type: SearchFieldType = "withButton";
export default function SearchDemo() {
const [query, setQuery] = useState<string>("");
return (
<SearchField
label="Search transactions"
placeholder="Search transactions"
type={type}
value={query}
onValueChange={setQuery}
onSearch={(q: string) => console.log(q)}
/>
);
}Variants and states
Every specimen is the real component from src/ui, held in one state.
Pastes as editable layers. Shadows are not exported.
Props
- label
- string · default none
- Required. The accessible name; the design has no visible label.
- type
- "basic" | "withButton" | "inline" · default "basic"
- Inline is a rounded, unbordered field.
- value, onValueChange
- string, (value) => void · default none
- Controlled text. Leave out value for uncontrolled.
- onSearch
- (value) => void · default none
- Called on Enter and on the Search button.
- error
- string · default none
- Marks the field invalid and shows the message.
- buttonLabel
- string · default "Search"
- showIcon
- boolean · default true
- The left search icon.
- ...rest
- InputHTMLAttributes · default none
- placeholder, disabled, name, and so on.
Figma to code
Figma properties by their exact names from Naming, and the React prop that carries each one. The table covers the shared properties that bear on this component; the Figma file decides which of them its component exposes. None means there is no prop for it yet.
- 🧰 Type
- type
- basic, withButton, or inline.
- 🎯 State
- value, error, disabled
- Filled is any text, which also shows the clear button. Hover and focus come from the browser.
- Placeholder
- placeholder
- Native attribute.
- Show Icon Left
- showIcon
- Boolean.
- Button Value
- buttonLabel
- With Button only.
Accessibility
What the code in src/ui does today, and what it leaves to you.
Keyboard
- A native search input in a form with role=search: Enter searches, the clear button and Search button are reachable with Tab.
Screen readers
- The field is named by label. The clear button is named Clear search. The error is linked with aria-describedby.
What you still need to do
- Announce the number of results when they change, for example in a live region.
When to use
The top of long lists and the header of content-heavy apps.
Do and don't
Do
- Say what can be searched in the placeholder.
- Show a clear empty state when nothing matches.
Don't
- Hide search behind an icon when it is the main task.
- Search on every keystroke against a slow server without debouncing.
Related
4 of 28 other molecules, same role and ready ones first.
- Amount InputAn input for money that formats the value as the user types.Ready
- ComboboxAn input that suggests matching options as the user types.Ready
- Date PickerChooses a date from a calendar or by typing.Ready
- File InputLets people choose or drop a file to upload.Ready
Status reflects the component tracker snapshot of 29 October 2026.