HkTag is the Vue chip: a compact, tone-coded label for a token, a filter or a selection, with an optional leading glyph and an optional close button whose × removes it. The close button is the library's standard icon button at its 16px rung, so the chip and the rest of the chrome share one button grammar. Reach for it when the user can see — or dismiss — an entity attached to something.
Vue only: the crate root has no mirror of this page. A same-named Rust component, Tag, is the older migration surface with a different markup; it is documented on Tag (legacy), and the two are not mirrors of each other.
A static status that cannot be dismissed is a Badge.
A field that collects several tags into an array value is HkTagInput; it composes chips like this one inside the field.
Import
tsx
1
import{HkTag}from"@celestia-island/hikari";
The Vue name is exported both as HkTag and as the short alias HTag; the examples use HkTag. The element is a <span>, so a tag that is also a button or a link is a composition the host builds, not a prop.
Variants
Six tones: default, primary, success, warning, danger and info. Each one sets the tint, the ink and the border of the chip from the theme palette.
size has two steps, sm and md (the default). The #icon slot renders in a span.hk-tag-icon before the text, at reduced opacity, and is sized by whatever glyph you put in it — the chip itself has no icon prop.
closable appends the close button, which emits close on a press and does nothing else by itself — the chip does not remove itself from the page, so the host owns the list and drops the entry. closeLabel becomes that button's aria-label; leaving it unset keeps the pre-prop markup byte for byte, which matters because the button is otherwise nameless.
The sample below keeps its own list so the removing is visible: pressing a × drops the tag, and the tags come back by reloading the sample.
The chip is a <span> with no role: it is not focusable and adds nothing to the tab order. Only the close button is reachable, and it is the icon button, so it takes focus like the rest of the chrome.
The close button has no visible text, so its name must come from closeLabel. Without it the button is announced as an unnamed button; a screen-reader user cannot tell "Remove release" from "Remove widgets".
Do not put interactive content other than the close button inside a tag: a nested link or button inside a non-interactive chip reads as a stray control.
The text is the label; the tone is never the message, so keep the meaning in words.
Related components
Tag (legacy) — the same-named Rust migration surface, which is not a mirror of this chip.
Badge — a static tone-coded label with no close button.
HkTagInput — the field that turns a list of tags into an array value.
HkCornerBadge — a mark anchored to another element's corner.