Don’t forget to check
WAI-ARIA
accessibility pratices for alerts when writting your markup.
Colors
Lexicon adopts in its design system the following colors below:
.alert.alert-success
.alert.alert-info
.alert.alert-warning
.alert.alert-danger
Non-standard Colors
The colors below do not follow Lexicon standards but follow the idea of satellite components, Clay provides non-standard colors to give you more flexibility to build UI that belong to the product.
.alert.alert-primary
.alert.alert-secondary
.alert.alert-dark
.alert.alert-light
Variant Sass API
The map $alert-palette allows generating any number of alert variants. If a key starts with ., # or %, Clay will output it as is, otherwise we will prepend .alert- to the key (e.g., .alert-primary). It will also generate a Sass placeholder prefixed by %calert- (e.g., %alert-primary).
This type of alert is specific for toast messages. These type of messages appear on the top right corner of the screen. The maximum width of a toast message is 360px, and the height can vary depending on the number of rows. It always has a close action.
Error: This is an error message
Info: This is an info message.
Success: This is a success message
Warning: This is a warning message.
Snippet
<divclassName="alert alert-dismissible alert-danger">
<spanclassName="alert-indicator"> ... </span>
<strongclassName="lead">Error:</strong> This is an error message
<buttonaria-label="Close"className="close"data-dismiss="alert"type="button"
>
...
</button>
</div>
<divclassName="alert alert-dismissible alert-info">
<spanclassName="alert-indicator"> ... </span>
<strongclassName="lead">Info:</strong> This is an info message.
<buttonaria-label="Close"className="close"data-dismiss="alert"type="button"
>
...
</button>
</div>
<divclassName="alert alert-dismissible alert-success">
<spanclassName="alert-indicator"> ... </span>
<strongclassName="lead">Success:</strong> This is a success message
<buttonaria-label="Close"className="close"data-dismiss="alert"type="button"
>
...
</button>
</div>
<divclassName="alert alert-dismissible alert-warning">
<spanclassName="alert-indicator"> ... </span>
<strongclassName="lead">Warning:</strong> This is a warning message.
<buttonaria-label="Close"className="close"data-dismiss="alert"type="button"
>
...
</button>
</div>
Embedded
Embedded alerts are meant for use in forms. Usually you will only need to use the information once. Its width depends on the width of the container it is placed in, always respecting the container margins to the content. The close action is not required for embedded alerts.
Error: This is an error message
Error: This is a success message
Error: This is an info message
Error: This is a warning message
Snippet
<divclassName="alert alert-danger">
<spanclassName="alert-indicator"> ... </span>
<strongclassName="lead">Error:</strong>This is an error message
</div>
<divclassName="alert alert-success">
<spanclassName="alert-indicator"> ... </span>
<strongclassName="lead">Error:</strong>This is a success message
</div>
<divclassName="alert alert-info">
<spanclassName="alert-indicator"> ... </span>
<strongclassName="lead">Error:</strong>This is an info message
</div>
<divclassName="alert alert-warning">
<spanclassName="alert-indicator"> ... </span>
<strongclassName="lead">Error:</strong>This is a warning message
</div>
Stripe
Stripe alerts are always placed below the last navigation element, either the header or the navigation bar. This alert usually appears on “Save” action, communicating the status of the action once received from the server. The close action is mandatory in this alert type. Its width is always full container width and pushes all the content below it.
Danger This is an error message
Success This is a success message
Info This is an info message
Warning This is a warning message
Snippet
<divclassName="alert alert-danger alert-dismissible alert-fluid">
<divclassName="container">
<spanclassName="alert-indicator"> ... </span>
<strongclassName="lead">Danger</strong> This is an error message
<buttonaria-label="Close"className="close"data-dismiss="alert"type="button"
>
...
</button>
</div>
</div>
<divclassName="alert alert-dismissible alert-fluid alert-success">
<divclassName="container">
<spanclassName="alert-indicator"> ... </span>
<strongclassName="lead">Success</strong> This is a success message
<buttonaria-label="Close"className="close"data-dismiss="alert"type="button"
>
...
</button>
</div>
</div>
<divclassName="alert alert-dismissible alert-fluid alert-info">
<divclassName="container">
<spanclassName="alert-indicator"> ... </span>
<strongclassName="lead">Info</strong> This is an info message
<buttonaria-label="Close"className="close"data-dismiss="alert"type="button"
>
...
</button>
</div>
</div>
<divclassName="alert alert-dismissible alert-fluid alert-warning">
<divclassName="container">
<spanclassName="alert-indicator"> ... </span>
<strongclassName="lead">Warning</strong> This is a warning message
<buttonaria-label="Close"className="close"data-dismiss="alert"type="button"
>
...
</button>
</div>
</div>
Feedback
Add the modifier alert-feedback on the alert element to remove the background, border, and padding.
Primary Indicator:with some additional text and a link.
Autofit Primary Indicator
Secondary Indicator:with some additional text and a link.
Secondary Indicator
Success Indicator:with some additional text and a link.
Success Indicator
Info Indicator:with some additional text and a link.
Info Indicator
Warning Indicator:with some additional text and a link.
Warning Indicator
Danger Indicator:with some additional text and a link.
An alternative to using autofit utilities, this keeps the text after the indicator icon from flowing under the icon when it breaks to a new line.
alert-dismissible
Success:Strong kopi-luwak half and half single origin single shot, half and
half instant latte brewed latte. At, decaffeinated, blue mountain
viennese barista, spoon carajillo shop viennese dark. And ristretto
caffeine, plunger pot black, café au lait galão flavour foam strong.
Macchiato roast, breve fair trade seasonal et cultivar.
alert-fluid
Primary:Strong kopi-luwak half and half single origin single shot, half and half
instant latte brewed latte. At, decaffeinated, blue mountain viennese
barista, spoon carajillo shop viennese dark. And ristretto caffeine,
plunger pot black, café au lait galão flavour foam strong. Macchiato
roast, breve fair trade seasonal et cultivar.
alert-feedback
Danger:Strong kopi-luwak half and half single origin single shot, half and half
instant latte brewed latte. At, decaffeinated, blue mountain viennese
barista, spoon carajillo shop viennese dark. And ristretto caffeine,
plunger pot black, café au lait galão flavour foam strong. Macchiato
roast, breve fair trade seasonal et cultivar.
Snippet
<divclassName="alert alert-dismissible alert-indicator-start alert-success">
<divclassName="alert-autofit-row autofit-row">
<divclassName="autofit-col autofit-col-expand">
<divclassName="autofit-section">
<spanclassName="alert-indicator">
<svgclassName="lexicon-icon lexicon-icon-check-circle-full"focusable="false"role="presentation"
>
<usexlinkHref="/icons.svg#check-circle-full"></use>
</svg>
</span>
<strongclassName="lead">Success:</strong>
<span
>Strong kopi-luwak half and half single origin single shot, half and
half instant latte brewed latte. At, decaffeinated, blue mountain
viennese barista, spoon carajillo shop viennese dark. And ristretto
caffeine, plunger pot black, café au lait galão flavour foam strong.
Macchiato roast, breve fair trade seasonal et cultivar.</span
>
</div>
</div>
</div>
<buttonaria-label="Close"className="close"data-dismiss="alert"type="button"
>
<svgclassName="lexicon-icon lexicon-icon-times"focusable="false"role="presentation"
>
<usexlinkHref="/icons.svg#times" />
</svg>
</button>
</div>
<divclassName="alert alert-fluid alert-indicator-start alert-warning">
<divclassName="container-fluid container-fluid-max-xl">
<spanclassName="alert-indicator">
<svgclassName="lexicon-icon lexicon-icon-warning-full"focusable="false"role="presentation"
>
<usexlinkHref="/icons.svg#warning-full"></use>
</svg>
</span>
<strongclassName="lead">Primary:</strong>
<span
>Strong kopi-luwak half and half single origin single shot, half and half
instant latte brewed latte. At, decaffeinated, blue mountain viennese
barista, spoon carajillo shop viennese dark. And ristretto caffeine,
plunger pot black, café au lait galão flavour foam strong. Macchiato
roast, breve fair trade seasonal et cultivar.</span
>
</div>
</div>
<divclassName="alert alert-danger alert-dismissible alert-feedback alert-indicator-start"
>
<spanclassName="alert-indicator">
<svgclassName="lexicon-icon lexicon-icon-exclamation-full"focusable="false"role="presentation"
>
<usexlinkHref="/icons.svg#exclamation-full"></use>
</svg>
</span>
<strongclassName="lead">Danger:</strong>
<spanclassName="component-text"
>Strong kopi-luwak half and half single origin single shot, half and half
instant latte brewed latte. At, decaffeinated, blue mountain viennese
barista, spoon carajillo shop viennese dark. And ristretto caffeine, plunger
pot black, café au lait galão flavour foam strong. Macchiato roast, breve
fair trade seasonal et cultivar.</span
>
<buttonaria-label="Close"className="close"data-dismiss="alert"type="button"
>
<svgclassName="lexicon-icon lexicon-icon-times"focusable="false"role="presentation"
>
<usexlinkHref="/icons.svg#times" />
</svg>
</button>
</div>
Inline
This changes an alert to use display: inline-block. It will only expand to be as wide as its content and max out at the parent container’s width.
Success:File uploaded. Would you like to add categories automatically?
Alert:A file with this name already exists.
Info:Would you like to add categories automatically?
Info:Would you like to add categories automatically?
The class alert-autofit-stacked-sm-down forces each autofit-col to stack on top of each other at screen sizes 767px and below, apply it on the alert element.
Success:File uploaded. Would you like to add categories automatically?
The class alert-autofit-stacked-xs-down forces each autofit-col to stack on top of each other at screen sizes 575px and below, apply it on the alert element.
Success:File uploaded. Would you like to add categories automatically?
These examples are not included in the Lexicon design system but they are built using foundations and Lexicon core components, these components may belong to the product or application.
<divclassName="alert alert-warning">
<spanclassName="alert-indicator"> ... </span>
<strongclassName="lead">Warning:</strong> This alert is a
<ahref="#1"className="alert-link">warning message</a>.
</div>
Dismissible Alerts
Success: This is a success closeable alert
Snippet
<divclassName="alert alert-dismissible alert-success">
<spanclassName="alert-indicator"> ... </span>
<strongclassName="lead">Success:</strong> This is a success closeable alert
<buttonaria-label="Close"className="close"data-dismiss="alert"type="button"
>
...
</button>
</div>
Alert Notifications Absolute
An absolute positioned container for placing alerts on the top right corner relative to .alert-container. Use this to create sticky positioned alerts with javascript, modifying the CSS property transform: translateY(); or margin-top when scrollY reaches a specific threshold. This component should generally be placed at the top of the page for sticky alerts aligned at the top.