U.S. flagA digital services project by Flexion

Alert

feedbackUSWDS-derived

A colored alert box for informational, warning, success, error, or emergency messages.

Reference: USWDS documentation ↗

Variants

Emergency Alert

Error Alert

Info Alert

No Icon Alert

Slim Alert

Success Alert

Warning Alert

Contract

Class mapping

USWDSFlexNotes
usa-alert.flex-alertBase alert class
usa-alert--infodata-variant="info"Informational alert
usa-alert--errordata-variant="error"Error alert
usa-alert--successdata-variant="success"Success alert
usa-alert--warningdata-variant="warning"Warning alert
usa-alert--emergencydata-variant="emergency"Emergency alert (dark background)
usa-alert--slimdata-slimSlim variant (no icon)
usa-alert--no-icondata-no-iconNo icon variant
usa-alert__heading.flex-alert__headingAlert heading
usa-alert__text.flex-alert__textAlert body text
usa-alert__body(none — flatter structure)We omit the body wrapper; content is direct children

Verified properties

background-colorborder-left-colorborder-left-width

Intentional differences

padding: ours = varies (icon via ::before), USWDS = varies (icon via background image)

Our alert uses CSS ::before for icons; USWDS uses background images on __body. Padding differs to accommodate.

Behavior promises

  • ✓ Icon color matches ink for standard variants
  • ✓ Emergency icon is white (inverted for dark background)
  • ✓ Emergency has dark background with white text and links
  • ✓ Slim variant hides icon
  • ✓ No-icon variant hides icon
  • ✓ Accessibility audit passes for all variants

Source CSS

Base styles: Alert Icon Base