Skip to content

Search field

The search bar's 56px pill as a search box that filters a page, a list or a table in place, with a clear button. It never opens a search view.

import { SearchField } from '@windmorph/react';

Purpose

A SearchField filters what's already on the screen (a settings page, a table, a list pane) as the person types. It's the search bar's 56px pill, filling its container, and it never opens a search view. Escape clears the query, Enter calls onSubmit, and a clear button shows while there's text; it clears and keeps focus in the input. It is controlled with value / onChange.

When to use which

  • SearchField filters content in place. Screen readers hear a search box.
  • SearchBar opens a view of suggestions or results, docked or full screen. Screen readers hear a combobox that opens a dialog.
  • TextField with type="search" is a search inside a form, with a label, supporting text and errors.

Filtering

Point aria-controls at what the field filters, and say when nothing matches in a role="status" region, so screen readers hear it. matchesSearch matches anywhere, ignoring case and accents, as a searchable Select does.

When not to use

For suggestions or results in a view of their own use a Search bar; for a search inside a form use a Text field.

See also

  • Search: A search bar that opens a full-screen view on phones and a docked view on larger windows, and an app bar with search.
  • Text field: Filled or outlined text input with a floating label, icons, affixes, counter, error icon and a text area.
  • Select: An exposed dropdown menu: a field that opens a menu of options. One or several choices, sections, a search for long lists, a sheet on phones.