Snackbar
Snackbars surface short updates about various system processes.
Anatomy

- Container: Main container of the component.
- Message: A short and concise message used to describe the operation or process that has taken place. Should be no longer than 2 lines.
- Dismissive Icon: Used to dismiss the snackbar.
- Leading Icon: Optional icon at the leading edge used to support the overall message.
Usage Guidance
- Snackbars do not require user interaction.
- Snackbars do not block user interaction with the page.
- Snackbars are temporary and their messages should not contain critical information that is imperative to the function of the page.
When to Use
- Snackbars should be used to communicate low impact updates or feedback about system processes.
When to Consider Something Else
- If the communication includes an action, consider using a Banner or Alert Dialog.
- If the communication is specific to errors or warnings on the page, use a Banner.
- If information is critical and requires user action or decision, consider using an Alert Dialog. Alert Dialogs are reserved for messages of the highest priority; they command user action by blocking any other interactions.
- Because snackbars are temporary messages, they should not be used for any messaging that needs to always remain visible, instead consider placing the content within the page and not in a popup.
- When no content can display on a page (due to a server error or connectivity issue, for example), use an Empty State, use the full page to communicate the status of the feature or to help educate users about its purpose. Empty states should include a message.
| Type | Emphasis | Purpose | Interaction |
|---|---|---|---|
| Snackbars | Low | Communicates updates about the progress of an application. | Temporary. Dismisses automatically after a short period of time but can also be manually dismissed. |
| Banners | Medium | Communicates errors or warnings about a task. | Top aligned. Remains persistent until the user resolves issue(s). |
| Dialogs | High | Communicates critical information that requires an action or decision. | Blocks all other interaction until a decision has been made. |
Behaviors
Placement
Snackbars reside at the bottom of the screen elevated above most all other screen elements. However they should never impede the Bottom Navigation Bar or any system bars and should instead reside 16 pts/dps above them. Snackbars should span the width of the screen minus a 16pt left/right page margin. Snackbars on iPad have a maximum width of 600 pts and are center aligned at the bottom of the screen.

Closing
Snackbars can be dismissed one of three ways:
- Tapping on the X icon within the snackbar.
- Swiping left, right, or down on the snackbar.
- Waiting 7 seconds, at which point they will automatically dismiss.
Multiple Messages
If communication about multiple processes is required, these should be broken up into multiple snackbars. However, a single snackbar should only be displayed at a time with each subsequent snackbar appearing after the previous one is dismissed.

Do
Only display one snackbar at a time.

Don't
Display multiple snackbars at the same time.
API Guidelines
Methods
Class name: Snackbar Module name: UIComponentsPlugin
public init(
featureData: FeatureMetricsData,
isPresented: Binding<Bool>,
message: String,
leadingWDIconName: String? = nil,
leadingIconAccessibilityLabel: String? = nil,
dismissClosure: @escaping () -> Void = {},
localizer: LocalizationAdapting
)Parameters
| Name | Description | Default values |
|---|---|---|
| featureData | the feature name/context and the screen ID in which the component appears. | |
| isPresented | Binding<Bool> to control the visibility of the snackbar. | |
| message | String representing the message to be displayed on the snackbar. | |
| leadingWDIconName | Optional string representing a leading icon for the snackbar. Defaults to nil. | nil |
| leadingIconAccessibilityLabel | Optional label for the leading icon. If the label is absent, the icon will be hidden from voice over. Defaults to nil. | nil |
| dismissClosure | Optional closure () -> Void which gets called when the snackbar is dismissed. | |
| localizer | LocalizationAdapting needed for localizing some of the default strings used in the snackbar. |
Accessibility Guidelines
Coming soon…
Content Guidelines
Snackbars are meant to be low emphasis, therefore the messages should be short and concise in order to maintain a lower imprint. Snackbars can accommodate multiple lines of text if need be.
Anatomy

- Container: Main container of the component.
- Message: A short and concise message used to describe the operation or process that has taken place. Should be no longer than 2 lines.
- Dismissive Icon: Used to dismiss the snackbar.
- Leading Icon: Optional icon at the leading edge used to support the overall message.
Usage Guidance
- Snackbars do not require user interaction.
- Snackbars do not block user interaction with the page.
- Snackbars are temporary and their messages should not contain critical information that is imperative to the function of the page.
When to Use
- Snackbars should be used to communicate low impact updates or feedback about system processes.
When to Consider Something Else
- If the communication includes an action, consider using a Banner or Alert Dialog.
- If the communication is specific to errors or warnings on the page, use a Banner.
- If information is critical and requires user action or decision, consider using an Alert Dialog. Alert Dialogs are reserved for messages of the highest priority; they command user action by blocking any other interactions.
- Because snackbars are temporary messages, they should not be used for any messaging that needs to always remain visible, instead consider placing the content within the page and not in a popup.
- When no content can display on a page (due to a server error or connectivity issue, for example), use an Empty State, use the full page to communicate the status of the feature or to help educate users about its purpose. Empty states should include a message.
| Type | Emphasis | Purpose | Interaction |
|---|---|---|---|
| Snackbars | Low | Communicates updates about the progress of an application. | Temporary. Dismisses automatically after a short period of time but can also be manually dismissed. |
| Banners | Medium | Communicates errors or warnings about a task. | Top aligned. Remains persistent until the user resolves issue(s). |
| Dialogs | High | Communicates critical information that requires an action or decision. | Blocks all other interaction until a decision has been made. |
Behaviors
Placement
Snackbars reside at the bottom of the screen elevated above most all other screen elements. However they should never impede the Bottom Navigation Bar or any system bars and should instead reside 16 pts/dps above them. Snackbars should span the width of the screen minus a 16pt left/right page margin. Snackbars on iPad have a maximum width of 600 pts and are center aligned at the bottom of the screen.

Closing
Snackbars can be dismissed one of three ways:
- Tapping on the X icon within the snackbar.
- Swiping left, right, or down on the snackbar.
- Waiting 7 seconds, at which point they will automatically dismiss.
Multiple Messages
If communication about multiple processes is required, these should be broken up into multiple snackbars. However, a single snackbar should only be displayed at a time with each subsequent snackbar appearing after the previous one is dismissed.

Do
Only display one snackbar at a time.

Don't
Display multiple snackbars at the same time.
API Guidelines
Methods
Class name: SnackBarUiComponent
@Composable
fun SnackBarUiComponent(
hostStateWrapper: SnackbarHostStateWrapper,
modifier: Modifier = Modifier,
message: String,
leadingIcon: Painter? = null,
leadingIconContentDescription: String? = null
)Steps to show the Snackbar from a screen:
- Add the [SnackBarUiComponent] as the SnackbarHost on the screen where the snackbar needs to be displayed.
- Add the [UIComponentsSnackbarHostState] to the screen that is using this component and call the [UIComponentsSnackbarHostState.showSnackbar] method to show the Snackbar.
Parameters
| Name | Description | Default values |
|---|---|---|
| hostStateWrapper | An instance of the [SnackbarHostStateWrapper]. | |
| modifier | The modifier to be applied to the Snackbar. | Modifier |
| message | The message to be displayed in the Snackbar. | |
| leadingIcon | The icon to be displayed at the leading edge of the Snackbar. | null |
| leadingIconContentDescription | The content description for the leading icon. | null |
Accessibility Guidelines
Coming soon…
Content Guidelines
Snackbars are meant to be low emphasis, therefore the messages should be short and concise in order to maintain a lower imprint. Snackbars can accommodate multiple lines of text if need be.
Can't Find What You Need?
Check out our FAQ section which may help you find the information you're looking for. For further information, contact the #ask-canvas-design or #ask-canvas-kitchannels on Slack.