Skip to content
English

How it works

A 24px-high pill (20px in size sm) with 13px / 500 text and a 6px dot in the pure status colour. Five semantics (success, warning, danger, progress, neutral) use a soft background and a text colour mixed 62% status colour with body text, which keeps at least 4.5:1 on cards and light grey panels in both themes. When status changes, the tint and text colour cross-fade in 240ms and the new dot (or icon) pops in with a slight overshoot; nothing moves on first render, so a long list does not flicker on load. With icon, shape tells states apart for colour-blind users. It is only text: not clickable, not in the Tab order. The demo is a launch task list whose tasks move on by themselves.

Use it for

  • Showing a record's state in lists, tables and detail pages: tasks, orders, payouts.
  • Several states side by side on a page, to tell done, watch, failing, running and ended apart at a glance.
  • States that screen readers and colour-blind users must also be able to read: text is always present.

Look elsewhere when

  • Anything that should filter, close or navigate on click: use a button, a link or a selectable chip.
  • Counts or unread markers: use a numeric badge.
  • Categories such as genre or campaign names: a category is not a state, so do not use the five status colours.

Usage

import { StatusTag } from './StatusTag.jsx'

// Map your own states to the 5 semantics, so one meaning always has one colour
const TASK_STATE = {
  running: { status: 'progress', text: 'In progress' },
  done: { status: 'success', text: 'Done' },
  overdue: { status: 'danger', text: 'Overdue' },
  pending: { status: 'warning', text: 'Pending' },
  cancelled: { status: 'neutral', text: 'Cancelled' },
}

export function TaskStateTag({ state }) {
  const { status, text } = TASK_STATE[state]
  // Only states that are still running pulse
  return (
    <StatusTag status={status} pulse={state === 'running'}>
      {text}
    </StatusTag>
  )
}

Props

PropTypeDefaultWhat it does
status'success' | 'warning' | 'danger' | 'progress' | 'neutral''neutral'Semantic: sets the background, text and dot colour.
childrenReactNode—The label text. Required: state must not rely on colour alone.
iconReactNode—Replaces the dot with a 14px icon (12px in sm; pass an svg, it takes the status colour). The dot is then hidden.
pulsebooleanfalseGives the dot a pulsing halo to show something is still running. Static under reduced motion; no effect with an icon.
size'md' | 'sm''md'md is 24px high with 13px text; sm is 20px with 12px text for dense tables.
classNamestring—Class name added to the root <span>.
...restHTMLAttributes—Other attributes (title, data-*, aria-*) go to the root <span>.

Accessibility

  • A plain <span>: not clickable, not in the Tab order; screen readers read the label text.
  • State is not colour alone: text is required and the dot or icon is decorative (aria-hidden).
  • The text colour keeps at least 4.5:1 on cards, page backgrounds and light grey rows.
  • The pulse halo and the change pop move only transform and opacity and are off under reduced motion.
  • In forced-colors (high contrast) mode the background is dropped, a thin outline is added and the dot uses the system text colour.

Motion

Still on first render. On a status change: colours cross-fade in 240ms and the dot pops from 0.2× to 1× in 360ms with a spring curve. With pulse, a halo behind the dot grows to 2.6× and fades every 1.6s, ease-out.

Add it to your project

Copy the prompt into Codex or Claude Code. The agent reads the published source, shows you what it will write and adds the component next to your own.

StatusTag.jsxstatus-tag.csstokens.cssREADME.md

Both files install together. The stylesheet reads the design tokens in tokens.css and carries fallbacks, so it also works alone.

Data display
Code diff comes with Pro. Its preview shows once you unlock it.
Flip countdown comes with Pro. Its preview shows once you unlock it.