Alerts communicate page-level feedback: alert alert-success with optional alert-dismissible and a close button. Badges annotate counts and status inline: badge text-bg-primary.
Accessibility
- Alerts use
role="alert"for important messages - Dismissible alerts need a visible close control with
aria-label - Do not rely on color alone—include text (“Success”, “Error”)
Badges pair with headings (h2 + badge) or buttons for notification counts. Contrast and semantics tie back to CSS color and contrast principles.
Self-check
- What class makes an alert closable?
- When is a badge more appropriate than a full alert?