Skip to content

Tag

A small tag used for marking and categorization.

Types

Tag types

DefaultPrimarySuccessWarningDangerInfo

Radius & size

Radius & size

PillXSSmallMediumLargeXL

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

ClosableClick × to closeRemoved after close

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

Trash closeMinus closeCustom label

Chip & clickable

chip: pill radius + compact padding; clickable: the whole tag is clickable, dispatching oas-click on click/Enter/Space.

Chip

Default chipPrimary chipSuccess chipWarning chipClosable chip

Clickable

Click me to dispatch oas-clickClickable chipRegular clickable tagDisabled, not clickable

In chip mode, disabled tags cannot be clicked (no oas-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

FeaturedCompletedFollowScheduled

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

DefaultSuccessChipDisabled, not selectable

checkable check icons

Selected (√)Star checkCircle-check chip

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

DefaultPrimarySuccessDanger

Filled

DefaultPrimarySuccessWarning

Solid

DefaultPrimarySuccessWarningDanger

Custom color

color accepts any CSS color value and overrides the type semantic color; it renders as filled when variant is unset.

color custom

PurpleSky outlinedRose solidGreen filled

Icon

The icon attribute reuses the oas-icon icon set; the icon renders before the text, sized to the font.

Icon tags

FeaturedCompletedScheduledMail

When href is set, the tag renders a native <a> internally; target is passed through.

href link tags

Open in new tabOutlined link

Max width ellipsis

max-width limits the tag content width; overflow is truncated with an ellipsis.

max-width ellipsis

This is a very long tag label that will be truncated with an ellipsis when it exceeds the maximum widthShort

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

magentaredvolcanoorangegoldlimegreencyanbluegeekbluepurple

Preset colors solid

magentaredvolcanoorangegoldlimegreencyanbluegeekbluepurple

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

DefaultPublishedReviewingCustom color dot

processing pulse

ProcessingWaitingPolling

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

DefaultPrimary borderCustom color borderOutlined hit

strong

ImportantBold chip

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

This is a long tag label that wraps naturally in a narrow container on mobile instead of being truncatedA second multiline label showing the auto-height layout with vertical padding compensation

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

JJimAAnnaMMikeZZoe

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

Fade out & removeClick × to animateAnimated close

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

Click × to simulate async confirmRemoved after async

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

Option AOption BOption C

tag-group multiple

Tag ATag BTag C

tag-group disabled

Disabled ADisabled BDisabled C

API

oas-tag

AttributeDescriptionTypeDefault
checkableSelectable: click / Enter / Space toggles checked and dispatches oas-change; mutually exclusive with closableboolean
checkedChecked state (effective when checkable)boolean
checked-iconCheckmark icon before a checked checkable tag (iconRegistry name, default check)stringcheck
chipChip (pill radius + compact padding)boolean
clickableWhole tag clickable (focusable, dispatches oas-click)boolean
closableClosableboolean
close-iconCustom close-button icon (iconRegistry name), replaces the default ×string
close-labelaria-label of the close button (a11y context, e.g. "Remove tag xx"); defaults to the locale "Close"string
colorCustom 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 unsetstring
disabledDisabled (cannot be clicked or closed)boolean
dotStatus dot before the text (8px, color follows type / color)boolean
hitHeavy border: opaque semantic-color outline (follows the custom color when set)boolean
hrefLink URL: renders a native <a> when setstring
iconIcon name (reusing the oas-icon icon set), placed before the text, sized to the fontstring
loadingLoading state: spinner replaces the close icon and blocks clicks (oas-close detail has a done() callback the host calls after async work)boolean
max-widthMax width of the tag content (e.g. 120px); overflow is truncated with an ellipsis; with multiline it only constrains the width so content wrapsstring
multilineMultiline: content wraps (auto height + vertical padding compensation); with max-width content wraps instead of being truncatedboolean
processingPulsing status dot (implies dot); disabled under prefers-reduced-motionboolean
roundRoundedboolean
sizeSize: xs / small / medium (default) / large / xl; invalid values fall back to medium with a warningTagSizemedium
strongBold text (font-weight 600)boolean
targetHow the link opens (_blank / _self etc.), with hrefstring
typeTypeTagTypedefault
variantShape (orthogonal to type): outlined / filled / solid; when unset, keeps the legacy type renderingstring
EventDescription
oas-changeSelection toggled when checkable, detail: { checked }
oas-clickWhole-tag click (when clickable), detail contains originalEvent
oas-closeClose, cancelable; preventDefault prevents removal
NameDescription
defaultTag content

oas-tag-group

AttributeDescriptionTypeDefault
aria-labelAccessible name of the group container (defaults to i18n "Tag group")
disabledDisables the whole group (children cannot toggle)boolean
multipleMulti-select mode (value holds comma-separated selected values)boolean
valueSelected value: a single value for single-select, comma-separated for multi-selectstring
EventDescription
oas-changeSelection change. Single: detail: { value }; multiple: detail: { value: [] }
NameDescription
defaultMultiple <oas-tag checkable value="x"> children

Tag group API table is generated by the generator.

Released under the MIT OR Apache-2.0 License.