Skip to content

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.
DefaultPrimarySuccessWarningErrorInfo

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.
DefaultPrimarySuccessWarningErrorInfo

Round

round uses the pill radius.
CourseLivePublishedDraft

Sizes

Chip heights are tighter than Button: sm 22, md 24, lg 28.
sm 22md 24lg 28

Closable

The × button emits close and does not remove the tag. The accessible name is “Close”, or 「關閉」 when the document language is Chinese.
KnowledgeTag ARemovable

Icon

The icon slot sits before the label.
Verified Notice

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.
AllDesignEngineeringMarketingArchived

Disabled

disabled sets opacity to 0.5 and blocks close, check, and the focus ring.
DisabledPrimaryError

API ​

Tag Props ​

PropTypeDefault
type'default' | 'primary' | 'success' | 'warning' | 'error' | 'info''default'
variantsame as type—
size'sm' | 'md' | 'lg''md'
borderedbooleanfalse
roundbooleanfalse
closablebooleanfalse
checkablebooleanfalse
checkedbooleanfalse
disabledbooleanfalse
colorstring—

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 ​

NameDescription
defaultLabel
iconLeading icon

Tag Events ​

NameDescription
close× pressed. Bubbles; composed: true. Does not toggle checked.
update:checkedCheckable chip toggled. detail: { checked: boolean }.
checkSame payload as update:checked.

Space and Enter toggle a focused checkable tag. The component updates checked itself.

CSS Parts ​

PartDescription
baseChip surface. role="checkbox" when checkable
iconIcon slot wrapper
contentLabel
close× button
check-indicatorPresent when checkable, hidden unless checked. Style it to add a custom mark

CSS Variables ​

NameDescription
--gk-tag-colorSet from the color prop. Used as the chip fill

Accessibility ​

  • No role until checkable, which sets role="checkbox" and aria-checked.
  • The × control is type="button" with aria-label="Close" (「關閉」 when lang starts with zh).
  • disabled sets aria-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%).