Examples

Tones and variants

Soft (default), solid and outline; an optional status dot.

Preview
Example.tsx
import { Badge, HStack, Stack } from '@reactloom/ui';

export default function Example() {
  return (
    <Stack gap="3">
      <HStack gap="2">
        <Badge>Draft</Badge>
        <Badge tone="info">In review</Badge>
        <Badge tone="success">Paid</Badge>
        <Badge tone="warning">Overdue</Badge>
        <Badge tone="danger">Failed</Badge>
      </HStack>
      <HStack gap="2">
        <Badge tone="success" dot>Operational</Badge>
        <Badge tone="danger" variant="solid">3</Badge>
        <Badge tone="info" variant="outline">Beta</Badge>
      </HStack>
    </Stack>
  );
}

In context

Preview
INV-2041Due 12 Nov
Example.tsx
import { Badge, HStack, Text } from '@reactloom/ui';

export default function Example() {
  return (
    <HStack gap="2">
      <Text as="span" weight="semibold">INV-2041</Text>
      <Badge tone="warning" dot>Overdue</Badge>
      <Text as="span" tone="muted" size="sm">Due 12 Nov</Text>
    </HStack>
  );
}

API reference

Badge props
PropTypeDefault
tone
'neutral' | 'info' | 'success' | 'warning' | 'danger''neutral'
variant
'soft' | 'solid' | 'outline''soft'
size
'sm' | 'md''md'
dot
Leading status dot.
booleanfalse

Customization

Extracted from the component’s source on every build, so it matches the code. How the layers fit together is explained in Customization.

State attributes

Target these in your CSS to style states without depending on class names.

AttributeValues
[data-size]sm · md
[data-tone]neutral · info · success · warning · danger
[data-variant]soft · solid · outline

Theme tokens it reads

--pl-color-bg-inverse --pl-color-bg-subtle --pl-color-border-default --pl-color-danger-border --pl-color-danger-fg --pl-color-danger-on-solid --pl-color-danger-solid --pl-color-danger-subtle --pl-color-fg-default --pl-color-fg-inverse --pl-color-info-border --pl-color-info-fg --pl-color-info-on-solid --pl-color-info-solid --pl-color-info-subtle --pl-color-success-border --pl-color-success-fg --pl-color-success-on-solid --pl-color-success-solid --pl-color-success-subtle --pl-color-warning-border --pl-color-warning-fg --pl-color-warning-on-solid --pl-color-warning-solid --pl-color-warning-subtle --pl-font-size-xs --pl-radius-full

Accessibility

  • Badge text is read as part of the surrounding content; every tone meets 4.5:1 on its background.
  • Colour and the dot are never the only signal — the text says the status.

Usage guidelines

Do

  • Keep badge text to one or two words.

Don’t

  • Don’t make badges clickable — use a Button or Tag.