Badge
Small status label in five tones, with an optional dot.
Example
NeutralNewOnlineSyncingOffline
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 { Badge } from "@porcelana/ui";
import "@porcelana/ui/styles.css"; // once, at your app rootProps
Generated from the TypeScript types. Standard HTML attributes are passed through and not listed.
Badge
| Prop | Type | Default | Description |
|---|---|---|---|
aria-label | string | – | Defines a string value that labels the current element. @see aria-labelledby. |
dot | boolean | – | Adds a status dot. Color is never the only signal: keep the text. |
id | string | – | 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.