Badge
Display-only pill for contextual metadata — status, category, or counts.
Pass label+value for a split badge; compose BadgeDot/BadgeButton as children.
Usage
import { Badge, BadgeButton, BadgeButtonProps, BadgeDot, BadgeDotProps, BadgeEmphasis, BadgeProps, BadgeSize, BadgeTone, pillVariants } from "@desk/ui/components/badge";Best practices
Badge is display-only — never attach
onClick; useTag(interactive) or wrap aButton.For a notification count use
mode="count"(circular, tabular figures), notradius="full"+ manual classes.A standalone count needs an
accessibleLabel("3 unread"); inside an icon-only trigger, mark the badgearia-hiddenand fold the count into the trigger'saria-label.
Props
Badge
| Prop | Type | Default | Description |
|---|---|---|---|
| asChild | boolean | Merge props onto the child element instead of rendering a | |
| size | ResponsiveValue<PillSize> | "base" | Badge size — a single token or a per-breakpoint object like
|
| disabled | boolean | ||
| focused | boolean | Force focus ring display (for documentation/testing) | |
| hovered | boolean | Force hover state display (for documentation/testing) | |
| icon | LucideIcon | React.ComponentType<React.SVGProps<SVGSVGElement>> | ||
| iconPlacement | "end" | "start" | "start" | |
| label | string | Left segment of a split badge; renders a divider before | |
| loading | boolean | Show loading spinner | |
| loadingLabel | string | Label shown during loading | |
| testid | string | ||
| value | string | Right (emphasised) segment; shown alone when no | |
| mode | "default" | "count" | "default" | Badge display mode. |
| accessibleLabel | string | Accessible name for a standalone | |
| tone | "neutral" | "brand" | "danger" | "warning" | "success" | "info" | null | undefined | ||
| radius | "rounded" | "square" | "full" | null | undefined | ||
| emphasis | "outline" | "solid" | "ghost" | "soft" | "transparent" | null | undefined | ||
| asInput | boolean | null | undefined | Input-style chip: white bg + subtle shadow (unselected state). |
BadgeButton
| Prop | Type | Default | Description |
|---|---|---|---|
| asChild | boolean | ||
| icon | React.ReactNode | ||
| variant | "default" | null | undefined |
Also exports
- interface
BadgeButtonProps - component
BadgeDot - type
BadgeDotProps - type
BadgeEmphasis - interface
BadgeProps - type
BadgeSize - type
BadgeTone - const
pillVariants
Composition
Used by