If you answer yes, we store and analyse information that helps us improve the website. You can change your choice at any time at the bottom of the page. More about what we store and why.

We also store necessary information that cannot be opted out of. This makes the website work and keeps it secure.

Skip to main content

What are you looking for?

Try searching for…

Components

Search

Search allows users to quickly find relevant content on a website or in an application. The component consists of a search field, with or without a search button.

Search is deprecated and will be removed in the next major version. Read Search is being removed, what should you do? to see how you can make your own search field.

Use search when

  • users need help finding relevant information quickly on a website or in an application
  • users are expected to enter keywords or phrases to locate the most relevant content

Avoid search when

  • the content is easy to navigate without search
  • it replaces good navigation — search should complement navigation, not be the only method

Example

With clear button

Use Suggestion with Suggestion.Clear when users need a button to clear the search field. The button is shown when the field has a value.

With search button

Add a search button after the field when the search should be submitted with a button. The button can be primary or secondary.

Guidelines

The width of the search field should reflect the length of the search terms users typically enter. The size of the field signals what users can type. For example, a search field for national identity numbers should match the length of such a number. A main search field for a website should be wider so users can see several words at once. To avoid forcing users to scroll within the field, ensure it is not so short that parts of the text become hidden.

Text

Placeholder text should be used with caution, as it disappears when users start typing and may cause confusion. It must also meet accessibility contrast requirements, which may make it difficult to distinguish from entered text. Screen readers handle placeholder text inconsistently, so information should instead be provided through a label or description.

You should use a label above the search field when it is not obvious what users are expected to search for, or when the search field is part of a form.

Read more about labels, descriptions and placeholder text in forms.

Edit this page on github.com (opens in a new tab)