---
url: /components/search/guidelines.md
description: >-
  Search lets people enter a keyword or phrase to get relevant information.
  Search bars can display suggested keywords or phrases as the user types.
---

# Search

Search lets people enter a keyword or phrase to get relevant information. Search bars can display suggested keywords or phrases as the user types.

[Overview](overview.md) · [Specs](specs.md) · **Guidelines** · [Accessibility](accessibility.md)

<video controls src="https://firebasestorage.googleapis.com/v0/b/design-spec/o/projects%2Fgoogle-material-3%2Fimages%2Fmlfkefwf-GM3%20-%20Search%20Bar%20-%20Guidelines%2001%20-%20v02.mp4?alt=media" aria-label="A mobile UI search with hinted text “Search recipes”, “Mexican dishes” is entered, and a list of recipe results appear."></video>

When focused, a search bar can show a list of search suggestions. As text is entered, search results appear.

## Usage

Search helps people find information quickly.<br><br>Use search for products with many items to manage, such as files or messages.

![Mobile UI shows a search bar at the top of a message inbox.](/assets/4fcf02d4-mlfkhcoi-02.iK6LkWCb.webp)

Search helps people find information in large inboxes like messages or emails

### Different ways to search

The search entry point is dependent on a product’s needs, and should be easy to find:

* Search bar: Use to search contents in a specific view, like **Search your messages**
* [Search app bar](../app-bars/guidelines.md#ed1f4c54-fc2d-4544-b1ed-ac667181dabe "Search app bars provide an emphasized entry-point to open search."): Use this [app bar](../app-bars/overview.md "App bars contain page navigation and information at the top of a screen.") variant when search is the primary, global function
* Search [icon button](../icon-buttons/overview.md "Icon buttons help people take minor actions with one tap."): Use when search is a secondary action or not the main focus

![A mobile app with a search bar below the page title.](/assets/266b7162-mlfkodgz-03.BINmeuaQ.webp)

Add a **search bar** below a title to search specific content

![A mobile app with a search app bar.](/assets/9ab796e5-mlfkpcee-04.CpUYxpqS.webp)

For global search, use a persistent **search app bar**, integrated into an app bar

![A mobile app with a magnifying glass icon on the leading side of the app bar.](/assets/a356761c-mlfkq5y2-05.D3lAZUA6.webp)

Use a **search** **icon button** when search is a secondary action

<a id="a9b2df31-8561-4326-82cd-41ed6532b765"></a>

### Focused search

When a search entry point is selected, it opens [focused](../../foundations/interaction/states/applying-states.md#bc6d6853-48ef-490e-8076-448e89e69f0f "A focused state communicates when a user has highlighted an element, using an input method such as a keyboard or voice.") search.  

* Search suggestions can appear before text is entered
* Search results can show as someone is typing or after a search is executed
* Individual elements maintain their own interaction [states](../../foundations/interaction/states/overview.md "States show the interaction status of a component or UI element.") when search is focused

[More on search states](specs.md#65c58b10-4569-43d6-9c11-64a5b02f3099)

![Focused search with a list of suggestions on a mobile screen.](/assets/c896fa0f-mlfkz1fo-06.BHrQ-au_.webp)

When focused, a search bar expands to show search suggestions or results in a list

If search is the primary action, focused search can be a standalone destination reached from a [navigation bar](../navigation-bar/overview.md "Navigation bars let people switch between UI views on smaller devices.").

![Focused search on a mobile screen with a list of suggested contacts.](/assets/f0667b07-mlfkth1m-07.BXVQUkxO.webp)

Focused search can be a standalone destination, reached by selecting an item in a navigation bar

### Search suggestions & results

Search suggestions and results both appear in a [list](../lists/overview.md "Lists are continuous, vertical indexes of text and images.") component by default.<br><br>To help people find information quickly, consider adding variety and context, such as:

* Leading icons related to suggestions
* Category labels, like **Recent**, **Contacts**, or **Suggestions**
* Avatars or other high-priority items
* Filter chips to narrow down results

![Search with suggestions organized in a column, ending with a row of 5 contact avatars with names.](/assets/b3476776-mlflqra9-09.Djiqggae.webp)

Include high-priority items like avatars in search suggestions or results

### Gaps

Use gaps to separate a list of suggestions or results into groups.<br><br>[More on using gaps in lists](../lists/guidelines.md#9e96fd72-5bf3-49df-9baf-e025dcca344d)

![A gap separates the location and calendar list items from people and pets avatars.](/assets/798541b3-mlfm1yld-10.Cah2U7ow.webp)

To separate list items into distinct groups, use a gap

## Placement

A search bar is typically placed at the top of a screen to remain prominent and accessible. Its location depends on whether search is the primary focus of a product or a secondary action.

![Mobile UI with a search bar directly below a Settings headline.](/assets/fe1d423c-mlfmbc2s-21.BMWwnW5H.webp)

A search bar can be the primary focus of a page

![Mobile UI with a search bar centered at the top of the screen, above a row of Favorites avatars.](/assets/e9c502e8-mlfmc255-22.BJjBIj0a.webp)

Search bars should usually be placed at the top of the content

![A photos app with a search icon.](/assets/c0515896-mlfmcmiv-23.DZq1qwC7.webp)

Search can be a secondary action

<a id="4f6c921c-795f-4e06-9b12-27ae7d502adb"></a>

### Focused search layouts

When focused, search suggestions and results appear in a list below the search bar.  <br><br>There are two layout options:

* **Docked** opens a list below the search bar, with a scrim covering main content
* **Full-screen** expands to fill the screen

[More on adaptive design](#eb45ccc4-d1b5-4ea1-bee5-ea1c3d1c5436)

![Tablet UI shows a list of search results docked below the search bar.](/assets/26b05661-mlfmf49n-08.DjkPV9n2.webp)

Docked layout on a tablet

![Mobile UI shows a list of search results filling the screen.](/assets/c2fb149c-mlfmg7bg-07.DtFe3Jt-.webp)

Full-screen layout on mobile

## Anatomy

![6 elements of search.](/assets/c37e0c77-mlgr3p93-11.CqnBHgXX.webp)

1. Search bar container
2. Leading icon
3. Supporting text
4. Avatar or trailing icon (optional)
5. Input text
6. Container for search suggestions or results

### Search bar container

In the contained style, the search bar container remains the same shape in both the unfocused and focused states. Avoid changing the container behavior.<br><br>The container’s margins should be:

* Unfocused: 24dp
* Focused: 12dp

In the divided (baseline) style, a divider separates the search bar and results.

![Side-by-side comparison of a search container in unfocused and focused states.](/assets/9a7e4121-mlfmu14l-13.DG-CwGJA.webp)

Search bar containers have persistent, rounded corners

#### Container color

Search bars use the **surface container high** [color role](../../styles/color/roles.md "Material has 26 standard color roles organized into six groups: primary, secondary, tertiary, error, surface, and outline."). This role applies when the screen background is white or a tonal **surface** color, ensuring the container has clear contrast.

![2 mobile UIs show search bars on white and tonal backgrounds.](/assets/a7b9ae9b-mlfmvyj4-14.-ceIip37.webp)

Search bars use **surface container high** to provide clear contrast

Avoid using a **surface container high** color on a **surface container** background. This can cause the search bar to blend in, making it difficult for people to find.<br><br>To ensure proper contrast, use surface container roles that are more than one step apart.

::: warning Caution
![A “surface container high” search bar on a “surface container” background.](/assets/c39ce884-mlfn371r-15.Y4NnoBZR.webp)

Using a **surface container high** color on a **surface container** background reduces contrast and may affect accessibility
:::

### Icons & icon buttons

#### Leading icons

The leading side of a search bar should include either:

* A navigational icon button, such as a menu or arrow
* A non-functional search icon

![A search bar on a tablet screen contains a non-functional search icon and a trailing avatar.](/assets/7593f4a0-mlfn8hr6-16.BUgUBY4m.webp)

A search bar can contain a non-functional search icon

#### Trailing icons

A search bar should have one or two trailing icons or icon buttons.<br><br>Trailing actions can include:

* Additional modes of searching like voice search
* A separate high-level action such as current location or profile
* An overflow menu
* A decorative search icon

![A search bar with 2 trailing icon buttons: a microphone and an overflow menu.](/assets/18fdc712-mlfnb1td-17.BO0lzy-g.webp)

Use a maximum of two trailing icons

![A search bar with a trailing microphone icon and avatar.](/assets/d4daedcd-mlfncrm8-18.CPENe7wA.webp)

Combine an avatar with up to one other trailing icon button

![Focused search with a trailing x icon to clear input text.](/assets/8a92fa14-mlfndiyw-19-vqa.K39JDhrF.webp)

Focused search can show an optional **clear** icon to remove input text

### Text

#### Hinted search text

Provide a short description of the information people can search, like **Search replies** or **Search your messages**.

#### Input text

When a person starts typing, the hinted text is replaced with the input text.

<video controls src="https://firebasestorage.googleapis.com/v0/b/design-spec/o/projects%2Fgoogle-material-3%2Fimages%2Fmlfngra0-GM3%20-%20Search%20Bar%20-%20Guidelines%2020%20-%20v02.mp4?alt=media" aria-label="A search bar labeled “Search replies”. “Peanut is entered and “Quick results” appear."></video>

Hinted search text is replaced when a search query is entered

<a id="eb45ccc4-d1b5-4ea1-bee5-ea1c3d1c5436"></a>

## Adaptive design

The search bar position and alignment should scale with the layout, and stay close to the searchable content.<br><br>In most cases, a search bar should:

* Stay in its pane and scale in width accordingly
* Internal elements anchor to the left and right as the parent container scales

[More on applying layout](../../foundations/layout/layout-overview/overview.md)<br>

<video controls src="https://firebasestorage.googleapis.com/v0/b/design-spec/o/projects%2Fgoogle-material-3%2Fimages%2Fmlfnplfk-GM3%20-%20Search%20Bar%20-%20Guidelines%2024%20-%20v01.mp4?alt=media" aria-label="A search bar keeps its layout region and scales with different window sizes and layouts."></video>

Keep the search bar close to the content a person can search

### Focused search

When focused, search can switch between showing suggestions or results in a:

* **Docked layout**: Best for [medium](../../foundations/layout/breakpoints/medium.md "Window widths from 600dp to 839dp, such as a tablet or foldable in portrait orientation.") and [expanded](../../foundations/layout/breakpoints/expanded.md "Window widths 840dp to 1199dp, such as a tablet or foldable in landscape orientation, or desktop.") windows
* **Full-screen layout**: Default for [compact breakpoints](../../foundations/layout/breakpoints/compact.md "Window widths smaller than 600dp, such as a phone in portrait orientation.")

[More on search layouts](specs.md#fc12e839-f356-4f48-9bd5-0ed210565bfe)

![Search suggestions in docked and full screen layouts.](/assets/8b2c1905-mlfnv4wh-25.q5tZvU0t.webp)

1. A docked layout on a large screen
2. A full-screen layout, the default for compact screens

Search suggestions or results should swap from full-screen in compact windows to docked in larger [breakpoints](../../foundations/layout/breakpoints/overview.md "Breakpoints are opinionated window sizes where a layout changes to match available space, device conventions, and ergonomics (previously window size classes).").

<video controls src="https://firebasestorage.googleapis.com/v0/b/design-spec/o/projects%2Fgoogle-material-3%2Fimages%2Fmlfo0cyf-GM3%20-%20Search%20Bar%20-%20Guidelines%2026%20-%20v02.mp4?alt=media" aria-label="Animation shows search suggestions adapting from full-screen on mobile to a docked layout as the window size increases."></video>

Search suggestions and results should adapt to fit different window sizes

## Behavior

### Focused search

When a search bar is selected, search becomes focused and can:

* Show historical suggestions before typing
* Show suggestions or results as someone is typing
* Wait to show suggestions or results until a search is queried 

The **back** icon releases focus, dismisses any suggestions or results, and returns the search bar to its original state.

<video controls src="https://firebasestorage.googleapis.com/v0/b/design-spec/o/projects%2Fgoogle-material-3%2Fimages%2Fmlgr7r58-GM3%20-%20Search%20Bar%20-%20Guidelines%2027%20-%20v02.mp4?alt=media" aria-label="When a search bar is tapped, it becomes focused, and suggestions appear in a list."></video>

When focused, a list of search suggestions can appear

<video controls src="https://firebasestorage.googleapis.com/v0/b/design-spec/o/projects%2Fgoogle-material-3%2Fimages%2Fmlgr95m2-GM3%20-%20Search%20Bar%20-%20Guidelines%2030%20-%20v01.mp4?alt=media" aria-label="A person searches a photo app. The back icon returns the search bar to its original state."></video>

Focus is released when the back icon is selected

### Scroll

Depending on needs, a search bar can:

* Scroll away with content, then reappear when a person begins scrolling up
* Remain fixed at the top of the screen

<video controls src="https://firebasestorage.googleapis.com/v0/b/design-spec/o/projects%2Fgoogle-material-3%2Fimages%2Fmlgrahif-GM3%20-%20Search%20Bar%20-%20Guidelines%2029%20-%20v01.mp4?alt=media" aria-label="Scrolling up hides the search bar. It reappears when scrolling down."></video>

A search bar can scroll up with content, then reappear when a person scrolls down

### Search results

To execute a search, a person can:

* Type a query and press **Enter**
* Select a suggestion or result without querying a search

Search results appear in a [list](../lists/overview.md "Lists are continuous, vertical indexes of text and images.") below the bar, and scroll beneath the bar.   <br><br>For accessibility, focused search needs a clear status indicator that it’s searching content, like a search icon or **Results** label. [More on search accessibility](accessibility.md)

![“Peanut” is the entered search query and the first suggestion in the list.](/assets/9c3d79d8-mlgrceqs-32.wY7qUYWj.webp)

Show search results in a compact, organized list, with an indicator like **Quick results**

When search results are queried, the input text should remain visible, but not in focus.

<video controls src="https://firebasestorage.googleapis.com/v0/b/design-spec/o/projects%2Fgoogle-material-3%2Fimages%2Fmlgrdhl9-GM3%20-%20Search%20Bar%20-%20Guidelines%2033%20-%20v02.mp4?alt=media" aria-label="“Pla” is entered into the search bar, “Plants” is suggested and selected."></video>

Search suggestions and results display in a list, and the input text remains visible

### Predictive back

On Android, [predictive back](https://github.com/material-components/material-components-android/blob/master/docs/foundations/PredictiveBack.md) allows a person to swipe left or right on search. 

* Search detaches from the screen edge to signal the full-screen layout will minimize
* The previous screen is revealed in a preview

[More predictive back design guidance](https://developer.android.com/guide/navigation/custom-back/predictive-back-gesture)

<video controls src="https://firebasestorage.googleapis.com/v0/b/design-spec/o/projects%2Fgoogle-material-3%2Fimages%2Fmlgrejsr-GM3%20-%20Search%20Bar%20-%20Guidelines%2034%20-%20v02.mp4?alt=media" aria-label="Swiping left on search causes the Android screen to scale left."></video>

The search surface and content scale back in the direction of the gesture
