Dot badge
A status chip led by a 6px tone dot, so colour is never the only cue.
Tones
OperationalDegradedOutagePaused
import { DotBadge } from "@/components/ui/dot-badge"
export default function DotBadgeTones() {
return (
<div className="flex flex-wrap items-center gap-2">
<DotBadge tone="positive">Operational</DotBadge>
<DotBadge tone="attention">Degraded</DotBadge>
<DotBadge tone="negative">Outage</DotBadge>
<DotBadge tone="neutral">Paused</DotBadge>
</div>
)
}
With a title
- APIOperational
- WebhooksDegraded
- ExportsPaused
import { DotBadge } from "@/components/ui/dot-badge"
const services = [
{ name: "API", tone: "positive", label: "Operational", checked: "Checked a minute ago" },
{ name: "Webhooks", tone: "attention", label: "Degraded", checked: "Deliveries are delayed by about 4 minutes" },
{ name: "Exports", tone: "neutral", label: "Paused", checked: "Paused for maintenance until 03:00 UTC" },
] as const
export default function DotBadgeWithATitle() {
return (
<ul className="flex w-full max-w-xs flex-col gap-3">
{services.map((service) => (
<li key={service.name} className="flex items-center justify-between gap-4">
{service.name}
<DotBadge tone={service.tone} title={service.checked}>
{service.label}
</DotBadge>
</li>
))}
</ul>
)
}
Installation
npx shadcn@latest add @khaeli/dot-badgebunx --bun shadcn@latest add @khaeli/dot-badgeInstall @khaeli/foundation first: this item's styling lives in its tokens and [data-slot] rules.
Installs with
- Registry items
Accessible name
- The dot is hidden from assistive technology with
aria-hidden: the text is the state, and the colour only repeats it. titleis a tooltip a mouse shows on hover. A keyboard or a touch screen never shows it, so keep anything a person needs in the text.
Registry JSON
The item as the shadcn CLI reads it, with every file it ships: https://ui.khaeli.com/r/dot-badge.json