<c-status>
A status pill: a short word naming the state of a record, such as Active, Pending or Failed, tinted with the colours of its status type.
Usage
Put the text in the default slot and pick a type. info, success,
warning and error paint that status family's colours; omitting type
renders a neutral grey pill.
<c-status type="success">Active</c-status>
When to use
- The state of an item in a table cell, list row or card: a job, an account, a booking.
- For a message that explains a situation or asks the user to act, use
c-alert: a persistent box in the page flow with a heading, an icon and a live-region role. - For feedback on an action the user just took, use
c-toasts. - For items in a set that the user picks or removes, use
c-tagelements in ac-tags; a status pill is not interactive. - For a count on another element, use
c-badge.
Appearances
appearance sets how the pill reads. filled (the default) paints the status
family's tint, its text in the tint's ink and its edge in a lighter shade of
the status colour. outlined keeps the ground behind the pill, with a grey
edge and plain text, so only the marker carries the colour: use it where a
column of filled pills would crowd a view with colour.
Markers
marker puts a symbol before the text:
icon: the status icon on a tinted halo, the same iconc-alertandc-toastdraw for the status. A neutral pill's halo holds a dot.dot: a dot in the status colour.none(the default): text only.
<c-status type="warning" marker="icon">Expiring</c-status>
<c-status type="success" appearance="outlined" marker="dot">Active</c-status>
For a state the status icons do not fit, put your own icon in the icon slot.
It replaces the marker whatever marker says, sits in the same halo and takes
the marker's colour. The pill sizes it to match the status icons: 14px, or
11px on a small pill and 18px on a large one, whatever the icon's own size.
A plain <svg> or <img> works too.
<c-status type="info">
<c-icon
slot="icon"
path="M3,3H21V7H3V3M4,8H20V21H4V8M9.5,11A0.5,0.5 0 0,0 9,11.5V13H15V11.5A0.5,0.5 0 0,0 14.5,11H9.5Z"
></c-icon>
Archived
</c-status>
Sizes
size is small (20px tall), default (24px) or large (32px), for a state
beside a page or card heading. The pill is as wide as its text; to line up
pills of different lengths in a column, give them a common minimum width:
c-status::part(root) {
min-width: 88px;
}
App defaults
appearance, marker and size take an app default, so an app sets its
house style once:
applyDefaults({ 'c-status': { appearance: 'outlined', marker: 'dot' } }). A
pill's own attribute wins, and marker="none" takes the marker off one pill.
Accessibility
The pill has no role and is not focusable: assistive technology reads its
text inline, and its colour is not conveyed. The marker, a slotted icon
included, is hidden from assistive technology. Make the text name the state
on its own. A changed status is not announced; when the user must hear about
the change, tell them through a live region, such as a c-alert or a toast.
Customization
::part(root) is the pill and ::part(marker) its marker: the icon's halo, or
the dot. The icon and the dot draw in currentColor, so setting color on the
marker part recolours them; the halo is the part's background.
The filled pill takes the status family's *-subtle fill and on-*-subtle
ink, and its edge is the status colour mixed into that fill.
c-status::part(marker) {
color: var(--my-brand);
}
Examples
<template>
<div class="example-grid">
<div class="example-row">
<c-status marker="dot">Draft</c-status>
<c-status marker="dot" type="info">Pending</c-status>
<c-status marker="dot" type="success">Active</c-status>
<c-status marker="dot" type="warning">Expiring</c-status>
<c-status marker="dot" type="error">Failed</c-status>
</div>
<div class="example-row">
<c-status appearance="outlined" marker="dot">Draft</c-status>
<c-status appearance="outlined" marker="dot" type="info">
Pending
</c-status>
<c-status appearance="outlined" marker="dot" type="success">
Active
</c-status>
<c-status appearance="outlined" marker="dot" type="warning">
Expiring
</c-status>
<c-status appearance="outlined" marker="dot" type="error">
Failed
</c-status>
</div>
</div>
</template>
<template>
<div class="example-row">
<c-status>Default</c-status>
<c-status type="info">Pending</c-status>
<c-status type="success">Active</c-status>
<c-status type="warning">Expiring</c-status>
<c-status type="error">Failed</c-status>
</div>
</template>
<template>
<div class="example-row">
<c-status marker="dot" type="info">
<c-icon slot="icon" :path="mdiArchive" />
Archived
</c-status>
<c-status appearance="outlined" marker="icon">
<c-icon slot="icon" :path="mdiArchive" />
Archived
</c-status>
</div>
</template>
<script setup lang="ts">
import { mdiArchive } from '@mdi/js';
</script>
<template>
<div class="example-grid">
<div class="example-row">
<c-status marker="icon">Draft</c-status>
<c-status marker="icon" type="info">Pending</c-status>
<c-status marker="icon" type="success">Active</c-status>
<c-status marker="icon" type="warning">Expiring</c-status>
<c-status marker="icon" type="error">Failed</c-status>
</div>
<div class="example-row">
<c-status marker="dot">Draft</c-status>
<c-status marker="dot" type="info">Pending</c-status>
<c-status marker="dot" type="success">Active</c-status>
<c-status marker="dot" type="warning">Expiring</c-status>
<c-status marker="dot" type="error">Failed</c-status>
</div>
</div>
</template>
<template>
<div class="example-row">
<c-status marker="icon" size="small" type="success">Small</c-status>
<c-status marker="icon" type="success">Default</c-status>
<c-status marker="icon" size="large" type="success">Large</c-status>
</div>
</template>
API reference
<c-status>
A status pill: a short word naming the state of a record, such as Active, Pending or Failed, tinted with the colours of its status type.
Properties
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
appearance | appearance | CStatusAppearance | 'filled' app default | `filled` (unless set, or changed app-wide) paints the status tint; `outlined` keeps the ground behind the pill and colours only the marker. |
marker | marker | CStatusMarker | 'none' app default | The symbol before the text: `icon` (the status icon on a tinted halo), `dot`, or `none` (unless set, or changed app-wide). A slotted icon replaces it. |
size | size | CStatusSize | 'default' app default | Size of the pill: `small`, `default` (unless set, or changed app-wide) or `large`. |
type | type | CStatusType | — | The status family whose tint and ink paint the pill; without it the pill is neutral grey. |
app default marks a prop you can set for every instance at once with applyDefaults() — an explicit attribute or property on an instance still wins.
Slots
| Slot | Description |
|---|---|
default | The status text, such as Active or Failed |
icon | An icon, such as a `c-icon`, that replaces the marker |
CSS parts
Style from outside with c-status::part(name) — parts are the library's only styling customization API.
| Part | Description |
|---|---|
root | The status pill wrapping the marker and the slotted text |
marker | The marker before the text: the icon's halo, or the dot |
Types
Importable from the package root: import type { … } from '@cscfi/csc-ui'
CStatusAppearance
How the pill reads: `filled` paints the status tint, `outlined` keeps the ground and colours only the marker.
export type CStatusAppearance = 'filled' | 'outlined';CStatusMarker
The symbol before the text: the status icon on a tinted halo, a dot in the status colour, or none.
export type CStatusMarker = 'dot' | 'icon' | 'none';CStatusSize
Size of the pill: 20px `small`, 24px `default` or 32px `large`.
export type CStatusSize = 'default' | 'large' | 'small';CStatusType
Status type of the pill. Each value paints the matching semantic status colours; omitting the attribute renders the neutral grey pill.
export type CStatusType = 'error' | 'info' | 'success' | 'warning';