Components · Forms · Search
Back to Search typesSearch
Use for letting people query or filter a set of content, like a table, a list, or a command palette.
Properties
Search fields skip a visible label by convention - the placeholder and a leading icon communicate purpose. Size, corner radius, placeholder, leading icon and clear button are properties of the same component, not separate fields - change them below to check this field's style and states in the Live Preview.
Live Preview
All 3 types compared side by side, each in all 6 states. One full matrix is rendered per selected combination of Size and Corner radius - check more than one option in a dropdown to see every combination side by side.
When to use
Any field that lets someone query or filter a set of content, rather than submit a value as part of a larger form.
Validation
Search is usually a standalone query field, not a required part of a form, so its validation is less about "did you fill this in" and more about handling the async states between typing and results.
- Loading state - show a subtle spinner in or near the field while results are being fetched, rather than freezing the list or leaving it blank with no signal that a query is in flight.
- No-results state - when a query genuinely matches nothing, say so specifically, e.g. "No results for 'invioce'" - and suggest checking spelling or broadening the query, rather than leaving an empty list with no explanation.
- Fetch failure - a network or server error is not the same as zero results - show a distinct message, e.g. "We couldn't load search results - try again," so the user knows to retry rather than assume the query matched nothing.
- Required marking - only relevant when Search doubles as a required filter field inside a form (uncommon) - in that case, mark and validate it the same as any required Input, on submit rather than on every keystroke.
Component Guide
Overview
Search is a text field purpose-built for querying or filtering a set of content - it intentionally skips a visible label by convention, since a search icon and placeholder text make its purpose obvious in the contexts it's used.
When to Use
- Global or site-wide search - a top-level search bar.
- Filtering a table, list, or dataset already on screen - narrowing visible rows as the user types.
- A command palette or inbox search - any live-filtering query field.
When Not to Use
- A value submitted as part of a larger form - use Input - Search implies live querying, not form submission.
- A field that needs a visible, persistent label for clarity (e.g. in a dense settings form) - use Input with a label instead of relying on the search icon alone.
- A field that should suggest specific matching values as you type - use Autocomplete if suggestions, not just filtering, are the goal.
Best Practices
- Debounce the query as the user types rather than searching on every keystroke, especially for server-side search.
- Always include a visible clear ('x') control once text has been entered.
- Show a clear empty-results state when a query returns nothing, rather than leaving a blank list.
Do and Don't
Do
Searches file names and contents.
Says what is being searched, and offers a clear affordance so the user can get back to the unfiltered list in one action.
Don't
With no scope stated and no way to clear, an empty result set is unreadable - the user cannot tell whether nothing matched or they searched the wrong thing.
Accessibility
- Even without a visible label, the field carries an accessible name (via aria-label or a visually hidden label) so screen readers announce its purpose.
- The clear button is independently focusable and labeled ("Clear search"), not just an icon with no accessible name.
- Live-updating results are announced via an aria-live region so screen-reader users know the list changed.
Related Components
Input, Autocomplete, Table, List.
{
"component": "Search",
"category": "Forms",
"summary": "Search is a text field purpose-built for querying or filtering a set of content - it intentionally skips a visible label by convention, since a search icon and placeholder text make its purpose obvious in the contexts it's used.",
"whenToUse": [
"Global or site-wide search - a top-level search bar.",
"Filtering a table, list, or dataset already on screen - narrowing visible rows as the user types.",
"A command palette or inbox search - any live-filtering query field."
],
"whenNotToUse": [
"A value submitted as part of a larger form - use Input - Search implies live querying, not form submission.",
"A field that needs a visible, persistent label for clarity (e.g. in a dense settings form) - use Input with a label instead of relying on the search icon alone.",
"A field that should suggest specific matching values as you type - use Autocomplete if suggestions, not just filtering, are the goal."
],
"bestPractices": [
"Debounce the query as the user types rather than searching on every keystroke, especially for server-side search.",
"Always include a visible clear ('x') control once text has been entered.",
"Show a clear empty-results state when a query returns nothing, rather than leaving a blank list."
],
"doAndDont": {
"do": "Says what is being searched, and offers a clear affordance so the user can get back to the unfiltered list in one action.",
"dont": "With no scope stated and no way to clear, an empty result set is unreadable - the user cannot tell whether nothing matched or they searched the wrong thing."
},
"accessibility": [
"Even without a visible label, the field carries an accessible name (via aria-label or a visually hidden label) so screen readers announce its purpose.",
"The clear button is independently focusable and labeled (\"Clear search\"), not just an icon with no accessible name.",
"Live-updating results are announced via an aria-live region so screen-reader users know the list changed."
],
"relatedComponents": [
"Input",
"Autocomplete",
"Table",
"List"
]
}