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

Chapter 09 Labels

Tag

A label the user added or can take away, such as an active filter or a topic. For a status like Paid or Late, use a badge.

Use it in Angular
import { TagComponent } from '@okaapi-ui/angular';

Labels

  • Angular
  • React
  • Accessibility
Angular
<ul class="flex flex-wrap gap-2" aria-label="Topics">
  <li><ui-tag>Angular</ui-tag></li>
  <li><ui-tag>React</ui-tag></li>
</ul>

Removable

The × is read as 'Remove Paid'. After a tag goes, focus moves to the next tag, or to Reset when none is left, so the keyboard never drops to the top of the page.

  • Paid
  • This week
  • Cairo
  • Delivery
Angular
<ul class="flex flex-wrap gap-2" aria-label="Active filters">
  @for (filter of filters(); track filter; let i = $index) {
    <li>
      <ui-tag removable (remove)="drop(i)">{{ filter }}</ui-tag>
    </li>
  }
</ul>
<!-- In drop(): remove it, then focus the next tag's × button -->

In Arabic

القاهرة
Angular
<ui-tag removable removeLabel="إزالة" (remove)="drop(0)">القاهرة</ui-tag>

When to use something else

If you needUse
A status the user cannot removeBadge
Let the user type new labelsChip input

Inputs

NameTypeDefaultWhat it does
removablebooleanfalseShows the × button.
removeLabelstring'Remove' from labelsThe button's first word; the tag's text follows it. Translate it.
(remove)void — The × was pressed. Remove the tag and move focus on.

Keyboard and screen readers

KeysWhat they do
Enter or Space On the remove button, take the tag away.
  • The remove button is named after the tag, such as Remove Angular.