Skip to main content
cngx-src documentation

CngxStatus

ComponentPrimaryOnPushNo encapsulationv0.1.0WCAG AA

projects/common/data/display/status/status.component.ts

Import#

import { CngxStatus } from '@cngx/common/data'

Description#

Semantic health indicator - a decorative tone dot paired with a visible label. Distinct from CngxBadge (count overlay), CngxChip (interactive) and CngxTag (labeled token): its single job is to communicate a status (operational / degraded / down / info).

Colour is never the only signal (Pillar 2): the tone drives the dot colour and a tone glyph, so a colour-blind reader still distinguishes the states, and the visible label carries the meaning for assistive tech (the dot is aria-hidden). Set live for a status that changes in place.

Basic

<cngx-status tone="success" label="Operational" />

Live-updating

<cngx-status tone="danger" label="Outage" live="assertive" />

https://cngxjs.github.io/cngx/examples/#/common/data/status/tone-matrix

Metadata#

Host#

Index#

Inputs#

label#string | undefined
input()

Visible status text. Carries the meaning for assistive tech.

live#"off" | "polite" | "assertive"
input()

Politeness of the live region. off (default) for a static status; polite / assertive for a status that changes in place.

default 'off'
input()

Semantic health. Drives both the dot colour and the tone glyph.

default 'neutral'

HostBindings#

BindingExpression
[class.cngx-status--success]tone() === 'success'
[class.cngx-status--warning]tone() === 'warning'
[class.cngx-status--danger]tone() === 'danger'
[class.cngx-status--info]tone() === 'info'
[class.cngx-status--neutral]tone() === 'neutral'
[attr.aria-live]live()

Default visuals for CngxStatus. The host carries .cngx-status - an inline-flex pair of a small tone dot (holding the tone glyph) and a label. Five tone modifiers pin the dot colour; the glyph inside the dot is the non-colour signal so the state survives a colour-blind reader.

Tone modifiers

  • --success - operational, success-coded
  • --warning - degraded, warning-coded
  • --danger - down, danger-coded
  • --info - informational
  • --neutral - unknown / idle, muted

Inheritance

  • --cngx-status-success-color -> --cngx-color-success
  • --cngx-status-danger-color -> --cngx-color-danger
  • remaining tone colours are leaf tokens, all swap in dark mode

Dark mode

Three hooks lift every tone colour to the foundation's dark variant:

  • prefers-color-scheme: dark
  • [data-color-scheme="dark"] / .dark class
  • [data-color-scheme="light"] / .light class (explicit pin)

Index#

Layout

--cngx-status-gap#<length>
Default value 6px

Gap between the tone dot and the status label.

--cngx-status-dot-size#<length>
Default value 1rem

Diameter of the tone dot.

Typography

--cngx-status-glyph-size#*
Default value 0.7em

Font-size of the tone glyph inside the dot, relative to the dot.

--cngx-status-dot-fg#<color>
Default value white

Foreground colour of the tone glyph, over the coloured dot.

--cngx-status-size#*
Default value 0.8125rem

Font-size of the status label.

--cngx-status-weight#<number>
Default value 500

Font-weight of the status label.

Variant / Success

--cngx-status-success-color#<color>
Default value oklch(0.65 0.18 145)

Colour of the --success tone dot. Falls back to --cngx-color-success.

See: [[--cngx-color-success]]

Variant / Warning

--cngx-status-warning-color#<color>
Default value oklch(0.75 0.15 85)

Colour of the --warning tone dot.

Variant / Danger

--cngx-status-danger-color#<color>
Default value oklch(0.65 0.22 25)

Colour of the --danger tone dot. Falls back to --cngx-color-danger.

See: [[--cngx-color-danger]]

Variant / Info

--cngx-status-info-color#<color>
Default value oklch(0.6 0.14 250)

Colour of the --info tone dot.

Variant / Neutral

--cngx-status-neutral-color#<color>
Default value oklch(0.6 0.02 290)

Colour of the --neutral tone dot.