Skip to content
Porcelana

Badge

Small status label in five tones, with an optional dot.

Data & display

Example

NeutralNewOnlineSyncingOffline
Example.tsx
import { Badge } from "@porcelana/ui";

export default function Example() {
  return (
    <div style={{ display: "flex", flexWrap: "wrap", gap: 10 }}>
      <Badge>Neutral</Badge>
      <Badge tone="primary">New</Badge>
      <Badge tone="success" dot>
        Online
      </Badge>
      <Badge tone="warning" dot>
        Syncing
      </Badge>
      <Badge tone="danger" dot>
        Offline
      </Badge>
    </div>
  );
}

Import

Import
import { Badge } from "@porcelana/ui";
import "@porcelana/ui/styles.css"; // once, at your app root

Props

Generated from the TypeScript types. Standard HTML attributes are passed through and not listed.

Badge

PropTypeDefaultDescription
aria-labelstring–Defines a string value that labels the current element. @see aria-labelledby.
dotboolean–Adds a status dot. Color is never the only signal: keep the text.
idstring–Element id. Generated automatically when omitted.
tone"primary" | "danger" | "neutral" | "success" | "warning" | null–Color tone. Text always carries the meaning too, never color alone.

Accessibility

  • Every tone meets 4.5:1 contrast in both themes.
  • The dot is decorative: the text always carries the meaning, never color alone.