Display
Badge
Small pill for a status, a count or a category. Penpot calls it Chip, and @statix/ui/badge exports both names.
import { Badge } from '@statix/ui/badge';
import { Chip } from '@statix/ui/badge'; // same componentPlayground
<Badge>Active</Badge>Examples
Tones
neutral is the default. accent marks something new or selected. ink is the strongest. Status variants use the soft fills.
<script lang="ts">
import { Badge } from '@statix/ui/badge';
</script>
<Badge>WordPress</Badge>
<Badge variant="accent">New</Badge>
<Badge variant="ink">Main domain</Badge>
<Badge variant="success">Paid</Badge>
<Badge variant="warning">Due soon</Badge>
<Badge variant="destructive">Overdue</Badge>
<Badge variant="outline">Draft</Badge>Status with a dot
dot adds a leading dot in the tone colour, as in the Penpot FlowChip states draft, running, done and issue.
<script lang="ts">
import { Badge } from '@statix/ui/badge';
</script>
<Badge dot>Draft</Badge>
<Badge variant="accent" dot>Running</Badge>
<Badge variant="success" dot>Done</Badge>
<Badge variant="destructive" dot>Issue</Badge>Sizes
md is 32px (h-chip). sm is 24px for table cells, counters and dense lists.
<script lang="ts">
import { Badge } from '@statix/ui/badge';
</script>
<Badge variant="accent">Support</Badge>
<Badge variant="accent" size="sm">Support</Badge>
<Badge size="sm">3</Badge>
<Badge variant="success" size="sm" dot>Paid</Badge>On tone cards
on-tone is a white/15 fill for chips on navy and other tone surfaces.
<script lang="ts">
import { Badge } from '@statix/ui/badge';
</script>
<Badge variant="on-tone">3 websites</Badge>
<Badge variant="on-tone" dot>All backups done</Badge>With an icon
Mark the icon with data-icon="inline-start" or "inline-end" so the padding balances.
<script lang="ts">
import { Badge } from '@statix/ui/badge';
import CheckIcon from '@lucide/svelte/icons/check';
import ShieldCheckIcon from '@lucide/svelte/icons/shield-check';
import ClockIcon from '@lucide/svelte/icons/clock';
</script>
<Badge variant="success">
<CheckIcon data-icon="inline-start" />
Backup done
</Badge>
<Badge>
<ShieldCheckIcon data-icon="inline-start" />
SSL active
</Badge>
<Badge variant="warning">
<ClockIcon data-icon="inline-start" />
Renews in 12 days
</Badge>As a link
Pass href and the badge renders an <a> with a hover fill.
<script lang="ts">
import { Badge } from '@statix/ui/badge';
</script>
<Badge href="#invoices" variant="destructive">1 overdue invoice</Badge>
<Badge href="#domains">6 domains</Badge>Guidelines
Do
- Keep labels to one or two words: "Active", "2 open", "Paid".
- Use the status variants for state and neutral for categories.
- Pair colour with a word. The label carries the meaning, the tone supports it.
Don't
- Don’t use a badge as a button. Use Button size="sm" for actions.
- Don’t mix many tones in one row. One status tone per row reads best.
- Don’t use the solid primary colour for badges. It is reserved for the main action.
Accessibility
- Renders a <span>, or an <a> when href is set. It has no role of its own.
- The status dot is aria-hidden. The text must say the status, not only the colour.
- For counters next to an icon, add context for screen readers, for example <span class="sr-only">unread messages</span>.
- Status text uses ink on success and warning soft fills, because the status colours fall below 4.5:1 on their soft fills.
API reference
Badge
renders<span> or <a> and accepts its attributesAlso exported as Chip.
| Prop | Type | Default |
|---|---|---|
variant | 'neutral' | 'accent' | 'ink' | 'on-tone' | 'success' | 'warning' | 'destructive' | 'outline' | 'ghost' | 'link' Tone. shadcn names work too: default maps to accent, secondary to neutral. | 'neutral' |
size | 'sm' | 'md' Height: sm 24px, md 32px. | 'md' |
dot | boolean Shows a leading status dot in the tone colour. | false |
href | string Renders an <a> instead of a <span>. | – |
ref bind | HTMLElement | null The rendered element. | – |
class | ClassValue Merged with the variant classes; yours win. | – |
| Data attribute | Meaning |
|---|---|
data-slot="badge" | Always present. |
data-variant | The current variant. |
data-slot="badge-dot" | The dot element, when dot is set. |
badgeVariants
tailwind-variants function with base and dot slots. Also exported as chipVariants.