Tag
Tag is a compact chip for status, category, and removable or checkable filters. Semantic colors use the same soft wash as Message. Checked filters use a 22% brand wash.
Demos
Types
default is a quiet gray fill. primary is solid brand with on-brand text. Success, warning, error, and info use a 16% wash and pressed-tone text. Bordered
bordered keeps the soft fill and adds a 1px type-colored border. Bordered primary switches from a solid fill to an 18% brand wash. Round
round uses the pill radius. Sizes
Chip heights are tighter than Button:
sm 22, md 24, lg 28. Closable
The × button emits
close and does not remove the tag. The accessible name is “Close”, or 「關閉」 when the document language is Chinese. Icon
The
icon slot sits before the label. Checkable filters
checkable exposes role="checkbox". Checked chips use a 22% brand wash and pressed brand text. Unchecked hover is an 18% wash. type="primary" stays solid when checked. Disabled
disabled sets opacity to 0.5 and blocks close, check, and the focus ring. API
Tag Props
| Prop | Type | Default |
|---|---|---|
type | 'default' | 'primary' | 'success' | 'warning' | 'error' | 'info' | 'default' |
variant | same as type | — |
size | 'sm' | 'md' | 'lg' | 'md' |
bordered | boolean | false |
round | boolean | false |
closable | boolean | false |
checkable | boolean | false |
checked | boolean | false |
disabled | boolean | false |
color | string | — |
Prefer type. variant is an alias; if both attributes are present on the first render, type wins. error uses the danger token. color sets the host variable --gk-tag-color and overrides the fill.
A static tag does not emit a click event. Closable and checkable tags are the interactive cases.
Tag Slots
| Name | Description |
|---|---|
| default | Label |
icon | Leading icon |
Tag Events
| Name | Description |
|---|---|
close | × pressed. Bubbles; composed: true. Does not toggle checked. |
update:checked | Checkable chip toggled. detail: { checked: boolean }. |
check | Same payload as update:checked. |
Space and Enter toggle a focused checkable tag. The component updates checked itself.
CSS Parts
| Part | Description |
|---|---|
base | Chip surface. role="checkbox" when checkable |
icon | Icon slot wrapper |
content | Label |
close | × button |
check-indicator | Present when checkable, hidden unless checked. Style it to add a custom mark |
CSS Variables
| Name | Description |
|---|---|
--gk-tag-color | Set from the color prop. Used as the chip fill |
Accessibility
- No role until
checkable, which setsrole="checkbox"andaria-checked. - The × control is
type="button"witharia-label="Close"(「關閉」 whenlangstarts withzh). disabledsetsaria-disabled="true"and removes the chip from the tab order.- Focus-visible uses a soft ring:
0 0 0 2px color-mix(focus-ring 70%).