A small label for statuses, counts and categories.
$ pnpm dlx shadcn@latest add https://dashral.com/r/badge.jsonInstallation
$ pnpm dlx shadcn@latest add https://dashral.com/r/badge.jsonAdds the component, the components it builds on, its npm packages and the theme tokens it uses. Using Dashral often? Add the registry to components.json once:
components.json
{
"registries": {
"@dashral": "https://dashral.com/r/{name}.json"
}
}Then add components by name:
$ pnpm dlx shadcn@latest add @dashral/badgeUsage
example.tsx
import { Badge } from "@/components/dashral/badge"
<Badge variant="soft" color="success" dot>
Paid
</Badge>Examples
API reference
Badge
Also takes every prop of <span>(opens in a new tab).
| Prop | Type | Default |
|---|---|---|
variant | "solid" | "soft" | "outline"How much it stands out. | "solid" |
color | "primary" | "neutral" | "info" | "success" | "warning" | "destructive" | "highlight"What it means. | "primary" (outline: "neutral") |
dot | booleanA status dot before the label. | false |
asChild | booleanRender the child element instead (e.g. a Next.js Link), passing these styles and props to it. | false |
className | stringExtra classes, merged with cn() so yours win. | — |
Accessibility
- Every variant and color meets WCAG AA contrast in both themes. Add an icon or word so meaning doesn't depend on color.