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:4pxColorsClassAction
Brand .badge—brandNeutral .badge—neutralSuccess .badge—successWarning .badge—warningInformation .badge—infoDanger .badge—dangerCritical .badge—critical.badge—pillMagenta accent .badge—magentaOrange accent .badge—orangeOlive accent .badge—oliveCyan accent .badge—cyanPeriwinkle accent .badge—periwinkle
@badge(style="", classes="", id=""){…body}NameTypeDescriptionDefault valueCopy
- stylestringstyle of badgebrand
- idstring
adds an id to the
.badgeblank - classesstring
adds CSS classes to the
.badgeblank - {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.