Tag
A small tag used for marking and categorization.
Types
Tag types
Radius & size
Radius & size
size supports five tiers: xs / small / medium (default) / large / xl; invalid values fall back to medium with a warning.
Closable
Clicking × dispatches oas-close (cancelable; preventDefault can prevent removal).
Closable tags
Custom close
close-icon customizes the close button icon (an oas-icon icon-set name, default ×); close-label customizes the close button's aria-label (screen-reader announcement, defaulting to the locale "Close").
Custom close icon & label
Chip & clickable
chip: pill radius + compact padding; clickable: the whole tag is clickable, dispatching oas-click on click/Enter/Space.
Chip
Clickable
In chip mode,
disabledtags cannot be clicked (nooas-click) nor closed (close button disabled).
Icon tags
The default slot can hold an icon — combining an icon and text forms an icon tag.
Icon tags
Selectable
checkable enables selection: click / Enter / Space toggles checked and dispatches oas-change (detail: { checked }); the selected state is a solid fill with a √ check icon before the text (checked-icon can customize the icon name). checkable is mutually exclusive with closable (the close button is hidden).
checkable tags
checkable check icons
Variants
variant provides three shapes: outlined / filled / solid; when unset, the legacy type rendering is kept (default white bg with gray border, colored types soft fill, primary solid).
Outlined
Filled
Solid
Custom color
color accepts any CSS color value and overrides the type semantic color; it renders as filled when variant is unset.
color custom
Icon
The icon attribute reuses the oas-icon icon set; the icon renders before the text, sized to the font.
Icon tags
Link
When href is set, the tag renders a native <a> internally; target is passed through.
href link tags
Max width ellipsis
max-width limits the tag content width; overflow is truncated with an ellipsis.
max-width ellipsis
Preset colors
color accepts 11 preset names (magenta / red / volcano / orange / gold / lime / green / cyan / blue / geekblue / purple, mapped to --oas-preset-* tokens, auto-brightened in dark theme); any CSS color value also works (see Custom color above). Unknown preset names are treated as plain color values.
Preset colors filled
Preset colors solid
Status dot
dot renders a small dot before the text (color follows type / color); processing adds a pulsing animation (disabled under prefers-reduced-motion) and implies dot.
dot status dots
processing pulse
Hit & emphasis
hit draws an opaque semantic-color border (follows the custom color when set); strong makes the text bold (font-weight 600).
hit bordered
strong
Multiline
multiline allows content to wrap (auto height + vertical padding compensation, for long content on mobile); when combined with max-width, the width constraint still applies — content wraps instead of being truncated.
multiline
Avatar tags
When the default slot holds an oas-avatar (or <img>), it is adapted automatically: sized to the tag tier, circular, with a negative margin to hug the left edge.
Avatar tags
Drag to reorder
A set of closable tags supports native HTML5 drag & drop reordering (dragstart / dragover / drop, re-rendered from the reordered array; no third-party dependency).
Drag to reorder
Close animation
oas-close is a cancelable event: after preventDefault the tag is not removed automatically, so you can fade it out first and then remove it.
Close animation
Async close
loading enters the closing-loading state: the close button shows a spinner and is disabled (aria-busy synced). Inside oas-close, preventDefault stops the auto-removal, the host runs the async task, then calls event.detail.done() to exit loading before removing the tag.
Async close
Tag group
oas-tag-group groups several checkable tags into a value selector: single-select (value as a single value) and multi-select (multiple + comma-separated value). Clicking a tag toggles selection and dispatches oas-change (single: detail: { value } / multiple: detail: { value: [] }); disabled disables the whole group. Child checked states are managed by the group (controlled).
tag-group single
tag-group multiple
tag-group disabled
API
oas-tag
| Attribute | Description | Type | Default |
|---|---|---|---|
checkable | Selectable: click / Enter / Space toggles checked and dispatches oas-change; mutually exclusive with closable | boolean | — |
checked | Checked state (effective when checkable) | boolean | — |
checked-icon | Checkmark icon before a checked checkable tag (iconRegistry name, default check) | string | check |
chip | Chip (pill radius + compact padding) | boolean | — |
clickable | Whole tag clickable (focusable, dispatches oas-click) | boolean | — |
closable | Closable | boolean | — |
close-icon | Custom close-button icon (iconRegistry name), replaces the default × | string | — |
close-label | aria-label of the close button (a11y context, e.g. "Remove tag xx"); defaults to the locale "Close" | string | — |
color | Custom color: 11 preset names (magenta / red / volcano / orange / gold / lime / green / cyan / blue / geekblue / purple, mapped to --oas-preset-* tokens) or any CSS value, overrides the type semantic color; renders as filled when variant is unset | string | — |
disabled | Disabled (cannot be clicked or closed) | boolean | — |
dot | Status dot before the text (8px, color follows type / color) | boolean | — |
hit | Heavy border: opaque semantic-color outline (follows the custom color when set) | boolean | — |
href | Link URL: renders a native <a> when set | string | — |
icon | Icon name (reusing the oas-icon icon set), placed before the text, sized to the font | string | — |
loading | Loading state: spinner replaces the close icon and blocks clicks (oas-close detail has a done() callback the host calls after async work) | boolean | — |
max-width | Max width of the tag content (e.g. 120px); overflow is truncated with an ellipsis; with multiline it only constrains the width so content wraps | string | — |
multiline | Multiline: content wraps (auto height + vertical padding compensation); with max-width content wraps instead of being truncated | boolean | — |
processing | Pulsing status dot (implies dot); disabled under prefers-reduced-motion | boolean | — |
round | Rounded | boolean | — |
size | Size: xs / small / medium (default) / large / xl; invalid values fall back to medium with a warning | TagSize | medium |
strong | Bold text (font-weight 600) | boolean | — |
target | How the link opens (_blank / _self etc.), with href | string | — |
type | Type | TagType | default |
variant | Shape (orthogonal to type): outlined / filled / solid; when unset, keeps the legacy type rendering | string | — |
| Event | Description |
|---|---|
oas-change | Selection toggled when checkable, detail: { checked } |
oas-click | Whole-tag click (when clickable), detail contains originalEvent |
oas-close | Close, cancelable; preventDefault prevents removal |
| Name | Description |
|---|---|
| default | Tag content |
oas-tag-group
| Attribute | Description | Type | Default |
|---|---|---|---|
aria-label | Accessible name of the group container (defaults to i18n "Tag group") | — | — |
disabled | Disables the whole group (children cannot toggle) | boolean | — |
multiple | Multi-select mode (value holds comma-separated selected values) | boolean | — |
value | Selected value: a single value for single-select, comma-separated for multi-select | string | — |
| Event | Description |
|---|---|
oas-change | Selection change. Single: detail: { value }; multiple: detail: { value: [] } |
| Name | Description |
|---|---|
| default | Multiple <oas-tag checkable value="x"> children |
Tag group API table is generated by the generator.