On this page
@addTagHelper *, Webority.Ui.RazorTones
Pick a tone because it signals something, not to decorate a row of peer badges.
Counts and labels
Use a count beside its label for a number, and a one- or two-word tag next to a title.
Dot style
Switch to the compact dot when the badge only needs to flag that something is there.
Content shape
Keep badge content to a word or a number; a sentence belongs in the page, not the badge.
Every option
Every value of every prop, one cell each.
tone: neutral | primary | success | warning | danger | info
(none, default)tone="neutral"tone="primary"tone="success"tone="warning"tone="danger"tone="info"dot
(default, no dot)dot, combined with tonecontent shape
numbershort labelnode childrenempty childrentooltip
(default, no tooltip)tooltip="Shown on hover or focus"tooltipPlacement: auto | top | bottom | start | end
tooltip-placement="auto" (default)tooltip-placement="top"tooltip-placement="bottom"tooltip-placement="start"tooltip-placement="end"className
class="analytics-flag"Guidance
What to do, and what to avoid.
Use it when
- A count sits beside a label, such as an unread inbox or a pending queue.
- A short static tag marks something: New, Beta, Pro.
- You need a tiny inline emphasis that fits on the same line as its text.
Reach for something else when
- You are showing a status mapped from an enum. → AppStatusBadge
- The token should be removable (a filter or tag). → AppChip
- It performs an action when clicked. → AppButton
- It is a persistent inline message. → AppAlert
Keep badge text to a word or a number
A short count attached to its label. The badge reads instantly.
A sentence in a badge is the wrong tool. Badges hold a word or a number, not prose.
Use one tone for one tag
A neutral New tag in one intentional tone.
The same label in three tones invents meaning that is not there. One tag, one tone.
Reference
Try every prop, read the full list, and check keyboard and screen reader behaviour.
5 props. The 4 most used come first.
Used on most screens 4 props
| Prop | Type | Default | Description |
|---|---|---|---|
| tonedefault - | neutral | primary | success | warning | danger | info | - | The badge colour. |
| dotdefault false | bool | false | Shows the badge in its compact dot style. |
| tooltipdefault - | string | - | A tooltip on hover or focus that flips to stay on screen. |
| tooltip-placementdefault auto | auto | top | bottom | start | end | auto | The preferred tooltip side. auto picks the side with the most room. |
Less common 1 props
| Prop | Type | Default | Description |
|---|---|---|---|
| (content)default - | string | - | Badge content: a short label or a number. |
Screen reader
2 notes- The badge is a plain inline element with no role of its own, so the text inside it carries the meaning.
- A tooltip opens on hover and on keyboard focus.
Do and avoid
2 pairsKeep badge text to a word or a number
A short count attached to its label. The badge reads instantly.
A sentence in a badge is the wrong tool. Badges hold a word or a number, not prose.
Use one tone for one tag
A neutral New tag in one intentional tone.
The same label in three tones invents meaning that is not there. One tag, one tone.