Search
A search field is a single-line input where people type what they are looking for
Overview
Use a search field when people need to find something by typing, like an item in a list, a page, or something across a product.

The search field only handles the typing. It doesn't show search results. This is on purpose, so you can design the results to fit the project or product you are building.
There are 5 states and one size.
Anatomy

Container: the box. It uses the same styling as the input.
Search icon: always on the left.
Text: the placeholder, or the text people typed.
Clear button: a small x on the right. It appears once there is text in the field.
The search field has no visible label. It still needs an accessibility label.
Do and Don't
Do

Use a short hint that shows what can be searched, like “Search orders, customers, or products
Dont

Use a vague placeholder like “Search...” or put instructions in it that disappear when typing starts.
Do

Keep the typed text in the field after results load, so it can be edited.
Dont

Clear the field on submit or make people retype to refine.
Do

Make the field wide enough to show a typical query without cutting it off
Dont

Make field so narrow that queries get clipped
What the search field doesn't include
The search field gives you the box where people type. Everything after that is up to your product:
The list of results
Suggestions or recent searches
Filters
The loading state
The empty state, when nothing is found
The field tells the product when the text changes and when someone searches. What happens next is your design.
States
The state is not set by hand. It follows what is happening in the field.

Placeholder
The field is empty and the placeholder is visible.
Hover
The pointer is over the field, and the background changes slightly. Touch screens have no hover.
Filled
The field has text. The clear button is shown.
Focus
The field is active and a ring appears around it. Focus with text in the field is a valid state, and it also shows the clear button.
Disabled
The field can't be focused or edited. The clear button is hidden.
When to use: when search exists but isn't available right now.
When not to use: when the reason isn't clear. If someone can't tell why search is disabled, explain it nearby.
Clear button
A small x that removes the text.
It appears once the field has text, in both the filled and focus states.
It clears the text and keeps focus in the field, so people can type again right away.
It is hidden when the field is empty and when the field is disabled.
It needs an accessibility label, like Clear search.
Rules and behaviors
Layout
The field uses the same box styling as the input.
The search icon is always on the left.
There is only one size.
Behavior
When the results update is up to the product. They can update as people type, after a short delay, or when people press Enter.
On mobile, the keyboard shows a search key instead of return.
A disabled field can't be focused or edited.
Best practice
If results update while people type, wait a short moment after the last key press, so the list doesn't flicker.
Keep the placeholder short and specific to what can be searched.
Always design the empty state, so people know what to do when nothing is found.
Accessibility
The field has no visible label, so it needs an accessibility label, like Search.
The clear button needs an accessibility label, like Clear search.
When results appear below the field, let screen readers know that the results changed.
Focus is shown with a ring, so keyboard users can see where they are.
A disabled field can't be focused.
