Skip to content
Alpha

Hololink UI is under active development. Components, APIs and these docs may change without notice.

Holo Tag

The <holo-tag> component (chip) renders a compact label. Set removable to show a dismiss button that emits a holoRemove event — the consumer is responsible for removing the element from the DOM in response.

Use it for:

  • Labelling or categorising an item with a short word: topics, filters applied, recipients.
  • Items the user can remove (removable), such as selected filters.

Don’t use it for:

NeutralSuccessWarningDangerInfo
<holo-tag variant="info">Info</holo-tag>

Removable

<holo-tag variant="neutral" removable>Removable</holo-tag>
<script>
document.querySelector('holo-tag').addEventListener('holoRemove', event => {
event.target.remove();
});
</script>

The tag shows its slotted text. With removable, it adds a native <button type="button"> whose accessible name is removeLabel (default “Remove”) followed by the tag text, for example “Remove Design”. The tag text itself has no role.

Key Action
Tab Moves focus to the remove button
Enter, Space Activates the remove button, which fires holoRemove
  • The remove button shows a visible focus ring with :focus-visible.
  • The component only emits holoRemove; it does not remove itself or move focus. That is your job.
  • Set remove-label to translate the verb. The tag text is always appended, so each remove button in a list has a distinct name.

You provide:

  • Clear tag text, and meaning that does not rely on variant colour alone.
  • Focus management after removal, for example moving focus to the next tag or a nearby control.
  • Tag text that is unique within a group, so the remove buttons stay distinguishable.

Importing

import '@philbob-sideprojects/hololink-ui/holo-tag';

Properties

PropertyAttributeTypeDefaultDescription
removableremovablebooleanfalseIf true, renders a dismiss button that emits holoRemove when clicked.
removeLabelremove-labelstring'Remove'The verb announced by the remove button. The button's accessible name is this text followed by the tag's text, for example "Remove Design".
variantvariant"danger" | "info" | "neutral" | "success" | "warning"'neutral'The semantic style variant of the tag, matching holo-badge.

Events

EventDetailDescription
holoRemovevoidEmitted when the dismiss button is activated.

Slots

SlotDescription
(default)The tag's label text.

CSS custom properties

PropertyDescription
--holo-tag-font-sizeFont size of the tag label.
--holo-tag-paddingInner padding of the tag.
--holo-tag-radiusCorner radius of the tag.