Skip to content

Toast Alerts

Toast alerts are used to provide timely information about system occurrences as well as feedback on the outcome of user actions.

Code

Variants

Lorem ipsum dolor sit amet consectetur adipiscing elit con.
Lorem ipsum dolor sit amet consectetur adipiscing elit con.
packages/certara-ui/src/components/toast/toast.tsx
<certara-toast variant="success" headline="Heading" dismissible>
Lorem ipsum dolor sit amet consectetur adipiscing elit con.
</certara-toast>

certara-toast

Properties

PropertyAttributeDescriptionTypeDefault
alignContentalign-contentThe content alignment inside the toast"center" | "left" | "right"'left'
dismissibledismissibleIf true, the toast can be dismissed by clicking the close buttonbooleanfalse
headlineheadlineThe bolded first sentence of the toaststringundefined
shakeshakeIf true, the toast will shake when it appearsbooleanfalse
variantvariantsets the theme/color of the toast"danger" | "info" | "success" | "warning"'info'

Events

EventDescriptionType
certaraCloseEvent emitted when the toast is closed if dismissible is trueCustomEvent<void>

Slots

SlotDescription
Default toast content
"alert-ctas"Slot for additional call-to-action buttons or links

Dependencies

Depends on

Graph

graph TD;
certara-toast --> certara-alert
certara-alert --> certara-close-button
style certara-toast fill:#f9f,stroke:#333,stroke-width:4px

In Practice

  • Toast alerts may be set to auto-dismiss after a certain period of time, but should always include UI for the user to manually dismiss.
  • Float on top of the other UI elements on the page; their presence does not alter the position of any other elements.
  • Always include a drop shadow.
  • Appear on the screen with an animation.

Variants

The four variants use different icons and colors to indicate the type and urgency of the message.

  • Info: informs the user of a change or gives them advice.
  • Success: lets the user know of a successful outcome. NOTE: Toast alerts are used by default for this type of messaging. Use a banner alert only if it is persistent, delayed, or if there is an additional action.
  • Warning: lets the user know about important system information that deserves caution.
  • Danger: alerts the user of a problem that requires immediate attention.

Placement

  • Default placement is top center of the page; sliding in from the left.
  • Final placement and animation direction may be determined on a case-by-case basis.

By default, toast alerts should appear stacked over content, at the top center of the viewport.

Content guidelines

  • Toast alerts typically do not include a title.
  • It’s best to keep their content short since they cover other UI elements on the page. (140 character max.)
  • Use sentence case and appropriate punctuation.

Accessibility

  • Toast alerts are dismissible with keyboard [esc].
  • For alerts with no actions, notify the user via assistance technologies without having to change focus to the toast alert.

Follow the accessibility guidelines for each component found in the alert. View guidelines

W3 guidelines for status messages

Design resources

View component in Figma