- Components
- Data display
- Badge
Badge
Displays a badge or a component that looks like a badge.
Badge
default.tsx
Installation
CLI
Manual
npm
pnpm
yarn
bun
Options
Variant
Use the variant
prop to control the visual style of the Badge
. The default variant is primary
.
NeutralOutlinePrimary
SuccessSuccess SubtleSuccess Outline
DangerDanger SubtleDanger Outline
WarningWarning SubtleWarning Outline
AccentAccent SubtleAccent Outline
variants.tsx
Size
Use the size
prop to control the size of the Badge
. The default variant is sm
.
SmallMediumLarge
sizes.tsx
Icon
To add additional context for the Badge
, use the icon
prop to add an icon.
BadgeBadgeBadge
icon.tsx
API Reference
Badge accepts all HTML span
element props and the following:
Prop | Type | Default | Description |
---|---|---|---|
neutral | "outline" | "primary" | "success" | "success-subtle" | "success-outline" | "danger" | "danger-subtle" | "danger-outline" | "warning" | "warning-subtle" | "warning-outline" | "accent" | "accent-subtle" | "accent-outline" | "primary" | The visual style of the badge. |
size | "sm" | "md" | "lg" | "sm" | The size of the badge. |
icon | React.ReactNode | - | An icon to display before the badge text. |