Skip to content

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).

PropTypeDefaultDescription
textResourceStr | undefinedundefined
variantBadgeVariant
BadgeVariant = 'default' | 'secondary' | 'destructive' | 'outline' | 'success' | 'warning' | 'info'
'default'
softbooleanfalseTinted background with coloured text instead of a solid fill.
sizingBadgeSize
BadgeSize = 'sm' | 'default' | 'lg'
'default'
pillbooleanfalseFully rounded (rounded-full). Count badges are always pills.
dotbooleanfalseLeading status dot; without text / count the badge is just the dot.
dotColorResourceColor | undefinedundefinedOverrides the dot colour.
iconstring | undefinedundefinedLeading lucide icon name.
iconRightstring | undefinedundefinedTrailing lucide icon name.
countnumber | undefinedundefinedNumeric badge (takes precedence over text).
maxnumber99Above max the count reads "max+". 0 = no cap.
showZerobooleanfalseKeep a count badge visible at 0.
removablebooleanfalseTrailing × that emits onRemove (tags, filters).
modifierAttributeModifier<RowAttribute>new SparkNoopModifier<RowAttribute>()
tokensBadgeTokens{}Per-instance token overrides (instance → theme --badge-* → recipe), see {@link BadgeTokens}.
EventTypeDefaultDescription
onRemove() => void() => { }

Slots: children (trailing closure)

MIT Licensed