Skip to content

Alert

An inline message for contextual feedback. Alerts surface important information without interrupting the user's workflow.

Preview

Variants

  • Info -- blue tint. General information or updates.
  • Success -- green tint. Positive confirmations.
  • Warning -- amber tint. Cautionary messages.
  • Error -- red tint. Problems or failures requiring attention.
  • Neutral -- grey tint. System or non-semantic messages.

Props

PropTypeDefaultDescription
variant'info' | 'success' | 'warning' | 'error' | 'neutral''info'Semantic colour
titlestring--Bold heading text
descriptionstring--Body text
iconReactNodeautoLeading icon (defaults to variant icon)
dismissiblebooleanfalseShows dismiss button
onDismiss() => void--Dismiss callback

Code example

React

tsx
import { Alert } from '@thepace/lexicon/components';

<Alert variant="success" title="Changes saved"
       description="Your settings have been updated." dismissible />

Vanilla HTML

html
<div class="lex-alert lex-alert--success" role="alert">
  <span class="lex-alert__icon"><!-- icon SVG --></span>
  <div class="lex-alert__content">
    <div class="lex-alert__title">Changes saved</div>
    <div class="lex-alert__description">Your settings have been updated.</div>
  </div>
  <button class="lex-alert__dismiss" aria-label="Dismiss">×</button>
</div>

CSS class reference

ClassPurpose
.lex-alertBase alert styles
.lex-alert--infoInfo variant
.lex-alert--successSuccess variant
.lex-alert--warningWarning variant
.lex-alert--errorError variant
.lex-alert--neutralNeutral variant
.lex-alert__iconIcon container
.lex-alert__contentTitle + description container
.lex-alert__titleBold title
.lex-alert__descriptionBody text
.lex-alert__dismissDismiss button

Accessibility

  • Uses role="alert" for important messages or role="status" for passive updates.
  • Error and warning alerts should use aria-live="assertive".
  • Dismiss button has aria-label="Dismiss".
  • Colour is never the only indicator — each variant includes a unique icon.

Guidelines

Do

  • Include both a title and description for clarity.
  • Use the dismiss button for non-critical alerts users can acknowledge.
  • Place alerts near the content they relate to.

Don't

  • Don't use alerts for validation errors on individual fields — use inline error text.
  • Don't stack more than 2 persistent alerts — combine or prioritise.

Released under the MIT License. A product by the pace.