Badges
Badges are either subtle or bold and use color to indicate meanings that users can learn and recognize across products.
Code
certara-badge
Properties
Property | Attribute | Description | Type | Default |
---|---|---|---|---|
type | type | "badge" | "circle" | "pill" | 'badge' | |
variant | variant | "brand" | "critical" | "cyan" | "danger" | "info" | "magenta" | "neutral" | "olive" | "orange" | "periwinkle" | "success" | "warning" | 'brand' |
Dependencies
Used by
Graph
graph TD; certara-tab-item --> certara-badge style certara-badge fill:#f9f,stroke:#333,stroke-width:4px
ColorsClassAction
Brand .badge—brand
Neutral .badge—neutral
Success .badge—success
Warning .badge—warning
Information .badge—info
Danger .badge—danger
Critical .badge—critical
.badge—pill
Magenta accent .badge—magenta
Orange accent .badge—orange
Olive accent .badge—olive
Cyan accent .badge—cyan
Periwinkle accent .badge—periwinkle
@badge(style="", classes="", id=""){…body}
NameTypeDescriptionDefault valueCopy
- stylestringstyle of badgebrand
- idstring
adds an id to the
.badge
blank - classesstring
adds CSS classes to the
.badge
blank - {body}htmlthe text of the badge. Can be a simple string or a computed value.blankn/a
Twirl usage with jQuery (or vanilla javascript)
Output the badge component in a template literal.
$td.append(`@badge(style="dark", classes="ml-2"){@Messages("Role Request")}`);
Animation effect
In Practice
Selecting the badge’s shape and color
- Use pills to display only counts.
- Use critical badges sparingly and reserve them to display only counts like unread notification or unresolved issues.
Accessibility
- Text must be clear enough for color blind users to be able to understand immediately without needing to rely only on the color.
- Avoid using badges for longer text. Badges are not focusable, so the text truncated after 200 (or the custom maxWidth value) pixels will not be accessible.