Web · Components
Badge
A small badge showing a status, label or number.
3 exports
Live example
Preview
New
Code
Events
- Events appear here when you interact with the preview.
Press effects (click or Space/Enter)
Corner shape
Style × color
neutralprimarydangersuccesswarning
neutralprimarydangersuccesswarning
neutralprimarydangersuccesswarning
Import
A small badge showing a status, label or number. A server component; uses the appearance settings of the nearest UIProvider in a client tree and of the defineAppearance registry on the server.
Examples
BadgeVariant
typeStyle of the badge.
BadgeProps
interfaceProps of the Badge component.
Extends: ComponentProps<"span">
| Name | Type | Default | Description |
|---|---|---|---|
tone? | Tone | "neutral" | Color. |
variant? | BadgeVariant | CustomVariant<"badge"> | "soft" | Style: built-in or a custom style added with defineAppearance. Defaults to UIProvider appearance.defaults.badge.variant. |
effect? | EffectProp | Effect or effects (e.g. "shine", ["pulse", "lift"]). Defaults to UIProvider appearance.defaults.badge.effect. See BuiltinEffect. | |
icon? | IconProp | Icon at the start of the text: a name ("check") or an element. | |
dot? | boolean | Puts a colored status dot at the start of the text (e.g. "Online"). | |
size? | "sm" | "md" | "md" | Size. |
tooltip? | TooltipProp | Tooltip shown on hover, focus or long press (e.g. what an abbreviation stands for). When given, the badge also becomes keyboard focusable. See TooltipProp. |