Tags are used within the Tag list component in input fields to represent selected values: Select Multiple, Tag autocomplete, Tag input.

Tags are most commonly used with a “Remove” button to allow users to delete a selected value from an input field. In some cases, tag removal should be disabled—when that’s the case, the close (×) icon should be hidden.

Tag text does not wrap to a new line; instead, it is truncated with an ellipsis.

Tags can be removed in several ways:

  • Click on the remove icon (kbqTagRemove directive) inside the tag.
  • Press Delete or Backspace key.
  • Programmatic removal through the component API.

The removal option is configured using the removable attribute (enabled by default).

Tags can be selected in several ways:

  • Click on the tag or set focus on it.
  • Space when the tag is focused.
  • Programmatic selection through the component API.

The selection option is configured using the selectable attribute (disabled by default).

To enable editing mode, set the editable property for kbq-tag.

Entering edit mode:

  • On double-click on the tag.
  • On pressing Enter or F2 key (when the tag is focused).

Saving changes:

  • On pressing Enter key.
  • On clicking the confirmation button (kbqTagEditSubmit directive).

Canceling changes:

  • On pressing Escape key.
  • On losing focus.

Do not use tag editing when complex validation is expected. Editing is configured so that it's impossible to save a tag with an invalid value. To prevent saving, use the preventEditSubmit attribute.

Use a Badge if you need a colored label in a table or key-value list. Tags should be used exclusively as tokens within input controls.

Key
Action
Space Select/deselect tag.
Delete / Backspace Remove tag.
F2 / Enter Start editing.
Ctrl + A Select all tags.
Key
Action
Enter Save changes.
Esc Cancel changes.
Suggestions for improvement
If you found a mistake or want to improve the article, create an issue on GitHub.