Loading...
Installation
Install the following dependencies:
Copy and paste the following code into your project.
Loading...
Update the import paths to match your project setup.
Composition
Badge └── content Badge (asChild) └── custom element
Examples
Custom Color
Loading...
Default
Loading...
Filter Chips
Loading...
Inline
Loading...
Removable
Loading...
Sizes
Loading...
Status
Loading...
Variants
Loading...
With Icon
Loading...
API Reference
Badge
| Prop | Type | Default | Description |
|---|---|---|---|
size | "default" | "lg" | "default" | Sets the badge size. |
variant | "default" | "destructive" | "ghost" | "link" | "outline" | "secondary" | "default" | Sets the badge's visual style. |
asChild | Snippet<[PropsFn<"span">]> | undefined | — | Replaces the default span with a custom element and forwards the badge props. |
Utilities and Supporting Types
| Export | API |
|---|---|
badgeVariants | Style recipe used to reuse the component variants. |
Angular
React
Solid
Svelte
Vue