Tag
Draft In review Published Needs work Blocked
Design Frontend Accessibility Docs
A small status chip: a colored label with optional icons, removable, and able to host a Count.
Import
Section titled “Import”<script> import Tag from "@invisible-ui/svelte/Tag.svelte";</script><script setup> import { Tag } from "@invisible-ui/vue";</script>import { Tag } from "@invisible-ui/react";<script type="module"> import "@invisible-ui/elements/define";</script>
<ds-tag></ds-tag>| Prop | Type | Default | Description |
|---|---|---|---|
status | TagStatus | "neutral" | Status/tone: neutral | info | success | warning | danger | selected. |
variant | "soft" | "solid" | "soft" | Tinted background or solid fill. |
size | "sm" | "md" | "md" | Chip size. |
removable | boolean | false | Show a remove button. |
removeLabel | string | undefined | undefined | Accessible label for the remove button. |
onRemove | (() => void) | undefined | undefined | Called when the remove button is pressed. |
icon | Snippet | undefined | undefined | Decorative leading icon. |
trailing | Snippet | undefined | undefined | Trailing content, e.g. a Count. |
| Prop | Type | Default | Description |
|---|---|---|---|
status | TagStatus | "neutral" | Status/tone: neutral | info | success | warning | danger | selected. |
variant | "soft" | "solid" | "soft" | Visual weight: a soft tinted surface (default) or a solid, filled chip. |
size | "sm" | "md" | "md" | Size of the chip. |
removable | boolean | false | Render a remove (✕) button. Defaults to false. |
removeLabel | string | undefined | Accessible name for the remove button. Defaults to the i18n catalog's "Remove". |
onRemove | () => void | undefined | Called when the remove button is pressed. |
Slots: default, icon, trailing.
| Prop | Type | Default | Description |
|---|---|---|---|
status | TagStatus | "neutral" | Status colour. |
variant | "soft" | "solid" | "soft" | A soft tinted surface (default) or a solid, filled chip. |
size | "sm" | "md" | "md" | |
removable | boolean | false | Render a remove button. |
removeLabel | string | — | Name of the remove button. Defaults to the catalog's "Remove". |
onRemove | () => void | — | Called when the remove button is pressed. |
icon | ReactNode | — | Decorative leading icon. |
trailing | ReactNode | — | Trailing content, such as a Count. |
children | ReactNode | — | The tag text. |
| Attribute | Reactive | Description |
|---|---|---|
status | yes | |
variant | yes | soft or solid |
size | yes | sm or md |
removable | yes | |
remove-label | yes | |
label | yes |
Reactive attributes re-render the element when they change after the first render.
Emits: remove after the remove button is activated. The element does not remove itself.
The children are the label; the icon snippet holds a leading icon and the
trailing snippet a trailing one.
Accessibility
Section titled “Accessibility”- Every status and variant puts its label at 4.5:1 or more. The solid warning
tag paints
--ds-components-general-feedback-warning-label-background-defaultunder the dark--ds-components-general-feedback-warning-solid-foreground-default(4.71:1 in both themes), because the warning colour itself gives that text 3.8:1 only.
Example
Section titled “Example”<Tag status="success" variant="solid">Published</Tag><Tag status="info" removable onRemove={() => {}}>Filter</Tag><Tag status="danger"> {#snippet icon()}<Icon><!-- … --></Icon>{/snippet} Blocked</Tag>Elements uses the same light-DOM regions and reports removal without deleting itself, so the application remains the source of truth:
<ds-tag status="success" removable remove-label="Remove status">Published</ds-tag>
<script type="module"> document.querySelector("ds-tag").addEventListener("remove", removeStatus);</script>In React, icon and trailing take markup, and onRemove reports the press
without removing the tag:
<Tag status="success" removable removeLabel="Remove status" onRemove={removeStatus}> Published</Tag>Themeable via --ds-tag-*.