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

Chapter 04 Fields

Chip input

A text field that collects several short values, such as toppings, email addresses or skills. Each value becomes a tag with its own named remove button. Screen readers hear each value being added and removed, and focus never falls off the field.

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

Toppings

Type, then Enter or a comma. Backspace in the empty field moves to the last tag; Enter on its × removes it and moves focus to the next.

  • Cheese
  • Olives

Press Enter after each one.

Value: [ "Cheese", "Olives" ]

Angular
<ui-chip-input
  label="Toppings"
  hint="Press Enter after each one."
  formControlName="toppings"
/>

In Arabic

  • جبنة
Angular
<ui-chip-input label="الإضافات" removeLabel="إزالة"
  [addedLabel]="added" [removedLabel]="removed" formControlName="toppings" />

added = (c: string) => `تمت إضافة ${c}`;
removed = (c: string) => `تمت إزالة ${c}`;

When to use something else

If you needUse
One value from a known listCombobox
A few choices that fit on screenCheckbox
Show labels the user cannot typeTag

Inputs

NameTypeDefaultWhat it does
labelstring — Required. Names the field and the list of tags.
hint | placeholderstring — Help under the field; text in the empty field.
removeLabelstring'Remove' from labelsFirst word of each × button's name. Translate it.
addedLabel | removedLabel(chip: string) => string`${c} added` from labelsWhat screen readers hear after a change. Translate them.

Keyboard and screen readers

KeysWhat they do
Enter or , Add what is typed as a tag.
Backspace In an empty field, move to the last tag’s remove button.
Enter or Space On a remove button, remove that tag.
  • Each tag has its own remove button, named after its value.
  • Adding and removing are announced, and focus moves to the next tag or back to the field.