Badge
A small label for status, counts, or categories.
import { Badge } from "antlitz";
API
| Prop | Type | Default |
|---|---|---|
| asChild | boolean | false |
| radius | "none" | "sm" | "md" | "lg" | "full" | none |
| size | "sm" | "md" | "lg" | md |
| tone | "base" | "muted" | "subtle" | base |
| variant | "solid" | "soft" | "outline" | "danger" | "success" | "warning" | "info" | "plain" | solid |
Variants
solidsoftoutlinedangersuccesswarninginfoplain
export function Variants() {
return VARIANTS.map((variant) => (
<Badge key={variant} variant={variant}>
{variant}
</Badge>
));
}Sizes
SmallMediumLarge
export function Sizes() {
return (
<>
<Badge size="sm">Small</Badge>
<Badge size="md">Medium</Badge>
<Badge size="lg">Large</Badge>
</>
);
}Radius
nonesmmdlgfull
export function Radius() {
return RADII.map((radius) => (
<Badge key={radius} variant="outline" radius={radius}>
{radius}
</Badge>
));
}Tones
BaseMutedSubtle
export function Tones() {
return (
<>
<Badge variant="outline" tone="base">
Base
</Badge>
<Badge variant="outline" tone="muted">
Muted
</Badge>
<Badge variant="outline" tone="subtle">
Subtle
</Badge>
</>
);
}Composition
VerifiedLinked badge
export function Composition() {
return (
<>
<Badge variant="soft" radius="full">
<Icon size={12}>
<path d="M20 6 9 17l-5-5" />
</Icon>
Verified
</Badge>
<Badge asChild variant="outline">
<Link href="/components/link" variant="plain">
Linked badge
</Link>
</Badge>
</>
);
}Badge keeps border border-transparent in its base rather than only on the
outline variant. Without it, switching to outline would change the badge's
size — which matters here because badges usually sit inline with text.