Tag

stable 0.7 kB
<hk-tag>

A compact label with a tone, an optional icon and a remove button that actually removes. Tones pair an icon with the colour so meaning survives colour blindness.

#chip#badge

Live demo

Running in this page — interact with it.

Inputs

NameTypeDefaultDescription
tone'neutral' | 'success' | 'warning' | 'danger' | 'info''neutral'Colour scheme.
iconstring''Leading icon class.
removablebooleanfalseShows the remove button.
size'sm' | 'md''md'Scale.

Outputs

  • removedEventEmitter<void>

    Emits when the remove button is pressed.

Keyboard

  • Tab Reaches the remove button
  • Enter / Space Removes the tag

Theming

Component tokens, each falling back to a global one:

PropertyDefaultControls
--hk-tag-radius999pxCorner radius.
--hk-tag-success-bg#ecfdf5Success fill.
--hk-tag-danger-bg#fef2f2Danger fill.

Accessibility

  • The remove button has its own accessible name including the tag text, so "remove canary" is announced rather than "button".
  • Tone is conveyed by icon and text as well as colour.

More in Data