Skip to main content
InputLevel 1

Search Field

搜索框

WebMobileDesktopDifficulty: Medium

An input box built purely for finding things, usually with a magnifier icon and a clear button.

01

Live Demo

Actually clickable

Popular searches

Click the field to try it — results appear live, along with popular searches.

What you just saw:The pill-shaped field with a magnifier at the top of an app home screen, the search bar at the top of an e-commerce search page, the search box that pops up in Mac Spotlight.

02

What it actually is

A Search Field is a stateful input: it does not just accept text, it also renders results, handles the empty result set, and keeps a search history. What separates it from a plain text field is type-ahead search and the ability to clear.

search fieldsearch barsearch inputsearch boxquery input
03

Anatomy · What it's made of

  1. Search Icon放大镜

    16px icon on the left

  2. Input输入区

    Light gray background to set it apart from a plain text field

  3. Clear Button清除

    An X icon appears once there is text

  4. Results结果列表

    Dropdown list, navigable with the arrow keys

  5. Empty State空结果

    Offers popular queries or suggestions

04

When to Use

When it fits, and when it doesn't
Search Field usage recommendations
SituationUse it?
There are more than 30 items and the user knows what they wantYes
Results should appear as the user typesYes
The search space is structured (filter by type or tag)Yes
There are only 5 items and they all fit on screenNo
The user cannot articulate what they are looking for (open-ended browsing)No

An empty search field must offer popular searches, recent searches, or category entry points — otherwise it is just an empty input.

When there are zero results, you must offer a way out (clear the filters, view everything).

05

Similar Patterns

Don't mix these up
06

How to tell AI

Three levels of prompt

Add the component name and specifics

Add a search field: a magnifier on the left, results updating live with a 300ms debounce as the user types, a clear button on the right, and popular-search chips in the empty state.

07

Don't just say this to AI

Bad → Better

Don't say this to AI

Add something people can search with.

Say this instead

Add a Search Field: a magnifier icon on the left, live results with a 300ms debounce, a clear button on the right once there is text, popular-search chips in the empty state, and ↑↓ to move through results.

08

Share this card

Social-ready

Turn this pattern into a 3:4 or 1:1 knowledge card and export it as PNG right in the browser. No backend needed.