Skip to content
Okaapiأوكابي
Framework for the code
Theme
Okaapi on GitHub

Chapter 04 Fields

Search field

A box to search with: a magnifier, the text, and a × to clear it. Escape clears it too, and Enter searches. A real search input, so phones show a Search key and screen readers say search.

Use it in Angular
import { SearchFieldComponent } from '@okaapi-ui/angular';
// The value is the text. Works with formControlName, [formControl] and ngModel.

Search a list

The label can be hidden where the page already says what is searched, as in a header. Screen readers still read it.

Angular
<ui-search-field
  label="Search orders"
  hideLabel
  placeholder="Order number or customer"
  formControlName="q"
  (submitted)="find($event)"
/>

With a visible label

In a form or a filter panel, keep the label in view.

Type a city or a street.

Angular
<ui-search-field label="Find a branch" hint="Type a city or a street." />

In Arabic

Angular
<ui-search-field label="ابحث في الطلبات" clearLabel="مسح البحث" placeholder="رقم الطلب أو اسم العميل" />

When to use something else

If you needUse
Search the whole app and run commandsCommand palette
Pick one value from a list as you typeCombobox

Inputs

NameTypeDefaultWhat it does
labelstring — Names the field.
hideLabelbooleanfalseKeeps the label for screen readers only.
placeholder | hintstring — An example inside the box; help text under it.
clearLabelstringClear search from labelsNames the × button. Translate it.
(submitted)string — Enter was pressed: the text to search for.

Keyboard and screen readers

KeysWhat they do
Enter Search.
Escape Clear the text.
  • A real search input, read as search; the clear button is named.