GitHubGitHub
← All components
Status / component

Badge

Compact categorical metadata with neutral and semantic tones, optionally led by a status dot.

NeutralInfoSuccessWarningDangerAccent
neutralinfosuccesswarningdangeraccent
<Badge tone="success">Validated</Badge>

Installation

pnpm add @chanrg/4ui

Import the stylesheet once, at the root of your app:

import '@chanrg/4ui/styles.css';

Usage

import { Badge } from '@chanrg/4ui';<Badge tone="success">Validated</Badge>

Status dot

Set `dot` when the badge names a live state, so the tone reads at a glance without relying on colour alone.

OnlineDegradedOfflineUnknown
<Badge tone="success" dot>Online</Badge>

API reference

Props

PropTypeDefaultDescription
toneneutral | info | success | warning | danger | accentneutralSemantic color treatment.
dotbooleanfalsePrefixes a small filled dot in the tone color.

CSS variables

VariableDescription
--4ui-surfacePrimary component surface.
--4ui-textPrimary foreground color.
--4ui-borderDefault control and panel border.

Accessibility

  • Badge text always carries the meaning; color is supplementary.

Dependencies

No runtime component dependencies.