Props
| Name | Description |
|---|---|
append:icon Type: string | Icon rendered after the label. On a |
clearable Type: booleanDefaultfalse | Renders a trailing clear button and emits Opt-in, which is the one thing that changed on the way from |
clearableLabel Type: string | Accessible name of the clear button, whole: set, it is the name on any body ("Remove the filter Deleted"). Rarely needed: unset, the name is composed from the localized Set it when a |
iconOnly Type: Responsive<boolean> | Shows only the badge's icon ( Keep writing the label ( |
loading Type: booleanDefaultfalse | Shows a spinner in place of the leftmost icon ( Also makes a slotted |
prepend:icon Type: string | Icon rendered before the label. See example |
pt Type: (PtCompoundOf<"", { readonly parts: readonly ["root", "icon", "spinner", "text", "clear"]; readonly states: readonly ["activeLink", "exactActiveLink", "loading"]; readonly wide: readonly ["activeLink", "exactActiveLink", "loading"]; readonly except: { readonly icon: readonly ["loading"]; }; readonly variant: { readonly names: readonly ["primary", "secondary", "destructive", "outline"]; readonly option: "badgeVariants"; }; }> & { text?: PtValue | undefined; root?: PtValue | undefined; icon?: PtValue | undefined; spinner?: PtValue | undefined; clear?: PtValue | undefined; "text:loading"?: PtValue | undefined; "text:activeLink"?: PtValue | undefined; "text:exactActiveLink"?: PtValue | undefined; "root:loading"?: PtValue | undefined; "root:activeLink"?: PtValue | undefined; "root:exactActiveLink"?: PtValue | undefined; "icon:activeLink"?: PtValue | undefined; "icon:exactActiveLink"?: PtValue | undefined; "spinner:loading"?: PtValue | undefined; "spinner:activeLink"?: PtValue | undefined; "spinner:exactActiveLink"?: PtValue | undefined; "clear:loading"?: PtValue | undefined; "clear:activeLink"?: PtValue | undefined; "clear:exactActiveLink"?: PtValue | undefined; } & { "text:outline"?: PtValue | undefined; "text:primary"?: PtValue | undefined; "text:destructive"?: PtValue | undefined; "root:outline"?: PtValue | undefined; "root:primary"?: PtValue | undefined; "root:destructive"?: PtValue | undefined; "icon:outline"?: PtValue | undefined; "icon:primary"?: PtValue | undefined; "icon:destructive"?: PtValue | undefined; "text:secondary"?: PtValue | undefined; "root:secondary"?: PtValue | undefined; "icon:secondary"?: PtValue | undefined; "spinner:outline"?: PtValue | undefined; "spinner:primary"?: PtValue | undefined; "spinner:destructive"?: PtValue | undefined; "spinner:secondary"?: PtValue | undefined; "clear:outline"?: PtValue | undefined; "clear:primary"?: PtValue | undefined; "clear:destructive"?: PtValue | undefined; "clear:secondary"?: PtValue | undefined; }) | Passthrough, object form: |
pt:<part> Type: PtValue | Passthrough, attribute form: one attribute per part, |
size Type: Responsive<keyof Sizes>Default'md' | Preset size of the badge: one size, or per breakpoint ( Pick it from the control standing next to the badge, not from a remembered constant: |
text Type: string | The label, when the default slot is empty (the slot wins), as on |
variant Type: BadgeVariantTypeDefault'primary' | Visual variant: |
Events
| Name | Description |
|---|---|
click:clear Type: (event: MouseEvent): void | Emitted when the clear button is pressed (only rendered when Fires when the clear button is pressed. The badge is controlled and removes nothing on its own — drop the item from your own state in the handler. Pressing the × never fires a slotted |
Slots
The listed properties are the ones exposed to the slot scope.
| Name | Description |
|---|---|
append:icon Type: BbBadgeIconSlotProps | The trailing icon, replacing |
default Type: object | The badge's label content. With A |
prepend:icon Type: BbBadgeIconSlotProps | The leading icon, replacing |
Renamed and removed
Names from v2 and from earlier 3.0 betas that no longer work, and what to write instead.
contentremovedfails silentlyiconprepend:iconfails silentlyAn icon-only badge:
prepend:icon="…" icon-only; the default slot stays its hidden label.- slot
iconprepend:iconfails silentlyAn icon-only badge:
#prepend:iconwithicon-only.