Styling contract
Headless Tag only reflects slots and state. The owner decides spacing, shape, colors, and how the close affordance looks.
Slot and state hooks
| Hook | Values | Where |
|---|---|---|
data-slot | tag, tag-icon, tag-close | Root and sub-parts. |
data-removable | present / absent | Tag root. |
data-disabled | present / absent | Tag root and close action. |
data-focused | present / absent | Close action. |
CSS starter
tag.primitive.css
css
[data-slot="tag"] {
align-items: center;
border-radius: 9999px;
display: inline-flex;
gap: 0.35rem;
}
[data-slot="tag-close"][data-focused] {
box-shadow: 0 0 0 2px var(--tng-semantic-focus-ring);
}
[data-slot="tag"][data-disabled] {
opacity: 0.62;
}
Owner guidance
Prefer styling by slot and reflected state instead of assuming a specific element type. That keeps your tag contract resilient if you swap wrappers or change the close host later.