For labels with arbitrary palette colors — categories, filters — take CdsTag; for counters and marker dots in the corner of an element — CdsBadge.
Variations
Statuses
The status prop sets one of the five semantic statuses. Assign the values to the states of the object: info — neutral, progress — the process is running, warning — needs attention, success — success, danger — a problem.
Display mode
The variant prop controls how prominent the status is. fill (the default) is a badge with a colored background; it catches the eye in lists and tables. text has no background, a colored status icon and neutral text: the semantics are kept, but the status does not compete with the surrounding content.
A similar "colored icon + text" pair can be assembled by hand — from CdsIcon with the color prop and text next to it. That way you are free to pick the icon and the color; variant="text", on the other hand, guarantees that the icon and the color always match the semantics of the status.
Indicator
The indicator prop puts a dot in the status color before the text. The status reads more compactly and fits dense lists well. With variant="text" the dot replaces the icon.
Pulse
The pulse prop makes the dot pulse and works only together with indicator. Enable it where a process is running right now: a check, an upload, a sync. Finished and static states do not need it — endless motion distracts (WCAG 2.2.2). Under prefers-reduced-motion the pulse is turned off.
Status change
When the status changes, the color of the fill, the text and the dot transitions smoothly, without a jump.
Text
The text comes from the text prop. When you need markup — emphasis, non-breaking spaces — use the default slot: it replaces the text from the prop.
Guidelines
Scenarios
Statuses of records in a list
In lists and tables a fill badge shows the state of a record at first glance. Keep the vocabulary of statuses short and consistent across the whole section — then the column can be scanned by color, without reading it.
Tracking a process
The status reflects the course of an asynchronous process: after being sent for review the object moves to progress, and once it is done — to success. The user sees the current state without reloading the page.
A status in a details block
In a dense info block — an invoice card, a panel of details — the fill background pulls attention away. The text variant sits in line with the rest of the data: the colored icon keeps the semantics, and the text stays neutral.
API
Props
| Name | Type | Default | Description |
|---|---|---|---|
content | string | number | undefined | — | Content displayed in the component. |
indicator | boolean | undefined | — | A dot in the status color before the text. With variant="text" it replaces the icon. |
pulse | boolean | undefined | — | Pulse of the dot. Works only together with indicator. Enable it only where a process is running right now: endless motion distracts and, per WCAG 2.2.2, should not accompany static states. Not animated under prefers-reduced-motion. |
status | "progress" | "danger" | "success" | "warning" | "info" | undefined | 'info' | Semantic status — drives the color and the default icon. |
text | string | number | undefined | — | Text displayed in the component. |
theme | string | undefined | — | Component theme |
variant | "fill" | "text" | undefined | 'fill' | Display mode: fill — a filled badge without an icon; text — a transparent background with a colored status icon. |
Slots
| Name | Type | Description |
|---|---|---|
default | any | Slot for the status text. |