Badge

A badge component for displaying labels, counts, or status indicators

Installation

Terminal
pnpm add @choice-ui/badge

Import

Component.tsx
import { Badge, type BadgeProps } from "@choice-ui/badge"

Basic

Badges are used to call attention to status, and come in a strong "filled" and light "outline" form.
Features:
- Supports multiple variants: "default", "brand", "inverted", "component", "success", "warning", and "error" for different semantic meanings. - The `strong` prop toggles between a filled (strong) and outlined (subtle) appearance. - Can display icons (e.g., status dots) alongside text for richer context. - Designed to be compact and easily embeddable in lists, cards, or next to headings.
Usage:
- Use badges to highlight new or beta features, status changes (e.g., "Added", "Removed"), or user roles (e.g., "Admin"). - Combine with icons to visually reinforce meaning (e.g., a dot for status). - Place badges near the content they annotate, such as next to feature names or user names.
Best Practices:
- Avoid overusing badges, as too many can reduce their impact. - Choose variant colors that align with your application's semantic color system. - Use concise, clear text within badges for quick recognition. - Ensure badges have sufficient contrast for accessibility.
Accessibility:
- Badges should have accessible text and sufficient color contrast. - When used with icons, ensure the icon is decorative or has an accessible label if it conveys meaning.
brand
brand
brand
brand
brand
component
component
component
component
component
default
default
default
default
default
error
error
error
error
error
inverted
inverted
inverted
inverted
inverted
success
success
success
success
success
warning
warning
warning
warning
warning

API reference

BadgePropsTypeDefault
as
ElementType
|
undefined
-
strong
boolean
|
undefined
-
variant
undefined
|
"default"
|
"brand"
|
"inverted"
|
"component"
|
"success"
|
"warning"
|
"error"
-
ref
((instance: HTMLDivElement
|
null) => void)
|
RefObject<HTMLDivElement>
|
null
|
undefined
-