Badge
Displays a badge or a component that looks like a badge.
Variants
Approximate web preview — the HarmonyOS rendering is the reference.
Status tones
success | warning | info, solid or soft (tinted).
Approximate web preview — the HarmonyOS rendering is the reference.
With icons
Leading / trailing lucide icons, or any content in the slot.
Approximate web preview — the HarmonyOS rendering is the reference.
Sizes & shapes
sizing: 'sm' | 'default' | 'lg'; pill: rounded-full.
Approximate web preview — the HarmonyOS rendering is the reference.
Dot & count
Status dots, bare dots and notification counts with a max.
Approximate web preview — the HarmonyOS rendering is the reference.
Removable
removable adds a × that emits onRemove (tags, filters).
Approximate web preview — the HarmonyOS rendering is the reference.
API
Extracted from the @Param / @Event / @BuilderParam declarations in the library sources.
SBadge
shadcn-vue Badge: inline-flex items-center gap-1 rounded-md border px-2 py-0.5 text-xs font-medium.
Variants: default | secondary | destructive | outline | success | warning | info, each soft (tinted) if wanted. sizing sm | default | lg, pill (rounded-full), dot (leading status dot — or a bare 8vp dot when there is no text), removable (trailing ×, emits onRemove) and count / max for notification counts ("99+"; hidden at 0 unless showZero).
| Prop | Type | Default | Description |
|---|---|---|---|
text | ResourceStr | undefined | undefined | |
variant | BadgeVariantBadgeVariant = 'default' | 'secondary' | 'destructive' | 'outline' | 'success' | 'warning' | 'info' | 'default' | |
soft | boolean | false | Tinted background with coloured text instead of a solid fill. |
sizing | BadgeSizeBadgeSize = 'sm' | 'default' | 'lg' | 'default' | |
pill | boolean | false | Fully rounded (rounded-full). Count badges are always pills. |
dot | boolean | false | Leading status dot; without text / count the badge is just the dot. |
dotColor | ResourceColor | undefined | undefined | Overrides the dot colour. |
icon | string | undefined | undefined | Leading lucide icon name. |
iconRight | string | undefined | undefined | Trailing lucide icon name. |
count | number | undefined | undefined | Numeric badge (takes precedence over text). |
max | number | 99 | Above max the count reads "max+". 0 = no cap. |
showZero | boolean | false | Keep a count badge visible at 0. |
removable | boolean | false | Trailing × that emits onRemove (tags, filters). |
modifier | AttributeModifier<RowAttribute> | new SparkNoopModifier<RowAttribute>() | |
tokens | BadgeTokens | {} | Per-instance token overrides (instance → theme --badge-* → recipe), see {@link BadgeTokens}. |
| Event | Type | Default | Description |
|---|---|---|---|
onRemove | () => void | () => { } |
Slots: children (trailing closure)