Component Toast Group

A toast group is the required container for toast components. You must place an empty toast group on the page to ensure screenreaders can detect an aria-live area upon page load, then add individual toasts as needed.

CodeUsage

Example

Props

AttrTypeDefaultDocs

position

"center" | "end" | "start"

'end'

This property sets the position on the screen toast will display.

Methods

NameReturnsDocs

addToast

Promise<void>

This public method is used to show a toast.

Events

EventDetailDocs

toastGroupDismissed

void

This event is emitted when a toast is dismissed.

Anatomy

The parts of a toast component as described in the caption.
  1. Toast group container: The outer wrapper that positions the toast on the screen.
  2. Left border: A semantic color that represents the message type (info, success, danger, warning).
  3. Icon (optional): A visual cue that indicates the message type (info, success, danger, warning). The icon color matches the left border color.
  4. Headline (optional): A brief title conveying the gist of the notification. Use sentence case and no punctuation.
  5. Message text: One or two short sentences that provide feedback, confirm an action, or display a status update. Avoid repeating the headline.
  6. Close button (optional): A button to dismiss the toast manually before it auto-dismisses.

Types

Info (default)

Use the info type to provide non-critical information.

Version 3.3 is now ready! Enjoy many new features and bug fixes.Your changes are saved automatically as you edit.

Success

Use the success type to confirm a successful action or completed task.

You have successfully added a new contact to your list.All 133 contacts were synced across your devices.

Danger

Use the danger type to alert that something has gone wrong.

Can't save file “ope.jpg” because another file with that name already exists.Could not connect to server. Please try again in a few minutes.

Warning

Use the warning type to caution about potential issues or unexpected results.

Please use a supported file type, such as .pdf, .docx, or .png.Free up some space to avoid issues.

Using with toast group

A toast group is the required container for toast components. You must place an empty toast group on the page to ensure screenreaders can detect an aria-live area upon page load, then add individual toasts as needed.

Colors

Each notification type has an associated color and matching icon to signify different tone and meaning. While icons are optional, color alone is not a sufficient way to convey meaning or distinguish status. To ensure accessibility, always provide an additional indicator, like a descriptive headline or an icon, to communicate information.

Behavior

Placement

Toasts appear in the bottom-right corner of the screen by default. You can change the positioning to bottom-center or bottom-left via the position prop on the toast group component. Multiple toasts will stack vertically, with newer toasts appearing below older ones.

Dismissal

Toasts can be timed or persistent. By default, a toast will disappear automatically after 10 seconds or when the user clicks the close button. You can adjust the auto-dismiss time or turn off auto-dismiss altogether. You can also hide the close button if you don’t want users to manually dismiss.

Interactions

Mouse

Clicking the close button dismisses the toast (if set to dismissible).

Keyboard focus

The Esc key closes the toast. Tab moves focus to the close button (if present). Enter or Space activates the close button (if present).

How to use

Toasts are similar to the alert, dialog, and modal components, but should be reserved for simple feedback, low-priority notifications, and confirmations that do not need to interrupt the user experience.

Key differences

ToastAlertModalDialog
PersistenceAuto-dismisses by default Non-dismissible by default Requires user to close manually Requires user action to dismiss
InterruptionNon-intrusive High visibility, blocks part of the UI Blocks entire UIBlocks entire UI
UrgencyLow to mediumHighHigh to criticalHigh to critical
PositionOverlay on bottom-right corner of screen by default, can be moved center or left Top of screen, spans full widthCentered on screen, above all other contentCentered on screen, above all other content
User interactionOptionalOptional, can be ignored or closed if set to dismissible Required to acknowledge and close Required to make decision or input
Use caseNotifications, status updates Site-wide changes, time-sensitive updates Informational, passive content, onboarding Form confirmations, decisions
DismissalAuto or manualPersistent (non-dismissible) or manual Manual (close button) Manual (explicit user action)

When in doubt:

Use a toast for quick, non-intrusive feedback.

Image of a toast notification used to provide quick, non-intrusive feedback.

Use an alert banner for important messages that require more attention but don’t block workflow.

Image of an alert notification.

Use a modal when displaying passive content that doesn’t require immediate action.

Image of a modal.

Use a dialog when the user must take action before continuing.

Image of a dialog.
Get in touch

Do you have an idea, or want to help us improve this page? Reach out to us via email.

DTMB-DG-Support@michigan.gov

Need help? Visit our Support page to learn how to get assistance, troubleshoot issues, and connect with the team.