badge
Badge
A short label such as new or sale, in the status colours and the commerce roles promo, discount, new and price, at three sizes.
States: Default, Hover, Focus
Parts
| Part | File | Does |
|---|---|---|
| Badge | Badge.vue | Marks an item with a short label such as new or sale. |
Styling
| Part | Recipe |
|---|---|
| Badge | badge |
Install
Writes 2 files into components/ui/badge/. For agents, npx @frontic/ui docs badge prints this reference as markdown; the MCP server serves the same.
- npm packages
- class-variance-authority
- reka-ui
API reference
Badge Badge.vue
Marks an item with a short label such as new or sale. Renders a <span>.
| Prop | Type | Default | |
|---|---|---|---|
| asChild | boolean | false | |
| as | AsTag | Component | 'span' | |
| variant | 'neutral' | 'info' | 'success' | 'warning' | 'error' | 'primary' | 'promo' | 'discount' | 'new' | 'price' | 'neutral' | |
| size | 'md' | 'sm' | 'lg' | 'md' | |
| class | ClassValue | — | |
| Data attribute | Values | |
|---|---|---|
| data-variant | 'neutral' | 'info' | 'success' | 'warning' | 'error' | 'primary' | 'promo' | 'discount' | 'new' | 'price' | |
| Recipe badge | Sets | |
|---|---|---|
| base: badge | 16 properties | |
| variant: neutraldefault | 2 properties | |
| variant: primary | 2 properties | |
| variant: info | 2 properties | |
| variant: success | 2 properties | |
| variant: warning | 2 properties | |
| variant: error | 3 properties | |
| variant: promo | 2 properties | |
| variant: discount | 2 properties | |
| variant: new | 2 properties | |
| variant: price | 2 properties | |
| size: sm | 2 properties | |
| size: mddefault | 5 properties | |
| size: lg | 5 properties | |
| variant: neutral · size: sm | 1 property | |
| variant: neutral · size: md | 1 property | |
| variant: neutral · size: lg | 1 property | |
Example