Back to Components

Flash Message

Overview

Flash messages are used to display contextual messages related to content on the page. This could be an action that was just performed by the user or an action that should be taken by the user.

Best Practices

Flash message should:

  • Be concise
  • Include only paragraphs of text
  • Use the headline attribute when the content of the message is large enough that it could benefit from an easy to scan headline.

Flash messages should not:

  • Be stacked. This can confuse and dilute the importance of each message.

Content guidelines

Flash messages should contain relevant information related to the current state of the page. This should only be conveyed via text; no images should be added within the container of the flash message.

Examples

Success Flash Message

Positive feedback and new things! Let's the user know that something good has happened.

Use for:

  • Success/Completion
  • Positive message
  • Trending upward
  • Above average trends
  • On-time/Ahead of schedule
Code example
Playroom

Error Flash Message

Super important. Let's the user know about high risk or high urgency messages.

Use for:

  • High risk/urgency messaging
  • Error/Failure
  • Late/Overdue status
  • Downward trends
  • Unsatisfactory timelines
  • Warning of irreversible actions

Seeing these banners can be stressful, use them judiciously.

Code example
Playroom

Warning Flash Message

Current action needs attention. Used mid-way through a process to highlight risk or to indicate that further action is required.

Use for:

  • Low risk/urgency messaging
  • Pending status
  • Below average (but stable) trends
  • Partial completion
Code example
Playroom

Info Flash Message

Tips, guidance and advice. Used to highlight general information and provide more context for the surrounding content.

Use for:

  • Helpful messages or usage tips
  • Unread messages or notifications
  • Average trends
Code example
Playroom
info-icon

Please note, reviews can only be written for orders fulfilled in the past 45 days.

info-icon

New delivery rates are now in effect.

Give our Caterer Care team a call (555-555-5555) to learn more about how these changes affect your store.

Dismissable Flash Message

Adding an onDismiss event handler will display an icon button in the top right hand corner of the flash message that can be used to dismiss the flash message. This state is local to the component in which the flash message is displayed.

Autohide flash messages should not be used with onDismiss.

Code example
Playroom

Autohide Flash Message

Adding an autohide flag will automatically hide the flash message after 5000ms, or a specified autohideDuration. Provide a onAutohide event handler for custom event handling when the flash message disappears.

For example, if an autohide flash message should only be viewed once (and not again on refresh), pass a custom function to onAutohide that handles persisting whether a message has been viewed or not.

Autohide flash messages should not be used with onDismiss.

Code example
Playroom