Skip to content

role searchbox

Search field draft v0.1.0

Lets people type what they are looking for.

A search field collects a search term: a query for a whole site, a filter for a list. It is a Text field with a search glyph at its start, exposed to assistive technology as a search box, and whose clear control the platform provides. It has a visible label, which may be the only word next to it (Search), and an optional description; it has no error state: a search that finds nothing is reported by the results, not by the field.

Guidelines

From apps/docs/content/components/search-field.md

Overview

A search field collects a search term: a query for a whole site, a filter for a list. It is a Text field with a search glyph at its start, announced as a search box, whose clear control the platform provides. It has a visible label, even when that label is just Search, and an optional description. It has no error state: a search that finds nothing is reported by the results.

This page applies to every platform. Where a platform differs, the difference sits under a sub-heading named after it (Web, iOS, Android, Desktop); everything else holds everywhere.

When to use

  • Searching a site, a product or a long list.
  • Filtering a list as people type (the docs’ token filter is one).

When not to use

  • Collecting a value that is not a query. Use a Text field.
  • Choosing among known values. Use a Select or a Radio group.

Sizes and states

Sizes follow the Text field (small, medium, large). States are default, hover, focus visible and disabled: no invalid, no read-only.

Content

  • The label says what is searched: Search, Search projects, Filter by name.
  • The placeholder gives an example or the scope (Name, email or role), never the label.
  • An empty result is reported next to the results, with what to try next.

Accessibility

The Specification tab lists the full accessibility contract, grouped into what holds on every platform and what is specific to one. Each statement there links the source it comes from. This section explains the decisions behind it.

Web

iOS

Android

  • Text field (free text)
  • Select (a choice among known values)