Badge
Label something with a small pill, such as a status, a count or a category.
Installation
Badge imports class-variance-authority (see Installation).
Usage
- Put plain text inside. The badge wraps its content in a
<text>element. - The badge hugs its text instead of stretching to fill its parent.
- It pops in with a short spring animation when it first renders.
Variants
Without the animation
Set animated to false for a badge that appears without popping in, for example in a long list.
API
UiBadge
No outputs.
The file also exports badgeVariants, the class-variance-authority function that returns the pill's classes for a variant, and the BadgeVariant type.
