{"componentChunkName":"component---src-pages-components-notification-usage-mdx","path":"/components/notification/usage/","result":{"pageContext":{"frontmatter":{"title":"Notification","description":"Notifications are messages that communicate information to the user. The two main types of notifications are toast notifications and inline notifications.","tabs":["Code","Usage","Style"," Accessibility"]},"relativePagePath":"/components/notification/usage.mdx","titleType":"prepend","MdxNode":{"id":"ccccb22b-e0a3-5ab7-a96a-5d161ed03534","children":[],"parent":"b8281de1-ab7c-54da-804f-a9bd0dd0187a","internal":{"content":"---\ntitle: Notification\ndescription: Notifications are messages that communicate information to the user. The two main types of notifications are toast notifications and inline notifications.\ntabs: [\"Code\", \"Usage\", \"Style\", \" Accessibility\"]\n---\n\n<PageDescription>\n\nNotifications are messages that communicate information to the user. The two main types of notifications are toast notifications and inline notifications.\n\n</PageDescription>\n\n<AnchorLinks>\n\n<AnchorLink>Overview</AnchorLink>\n<AnchorLink>Formatting</AnchorLink>\n<AnchorLink>Content</AnchorLink>\n<AnchorLink>Inline notifications</AnchorLink>\n<AnchorLink>Toast notifications</AnchorLink>\n<AnchorLink>Modifiers</AnchorLink>\n<AnchorLink>Related</AnchorLink>\n<AnchorLink>Feedback</AnchorLink>\n\n</AnchorLinks>\n\n## Overview\n\n### When to use\n\nUse notifications to inform users of updates or changes to system status. Communicating with users and providing immediate feedback are important for building trust. While notifications are an effective method of communicating with users, they are disruptive and should be used sparingly.\n\nFor more context on when to use each notification type, including modals, refer to the [notifications pattern](/patterns/notification-pattern/). Carbon currently only supports inline, toast, and modal notification types, although some product teams also support banners and notification centers.\n\n### Types\n\n| Type   | Purpose                                                                                                                                                          |\n| ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| Inline | Inline notifications show up in task flows, to notify users of the status of an action. They usually appear at the top of the primary content area.              |\n| Toast  | Toasts are non-modal, time-based window elements used to display short messages; they usually appear at the top of the screen and disappear after a few seconds. |\n\n## Formatting\n\n### Anatomy\n\n<Row>\n<Column colLg={8}>\n\n![notification anatomy image](images/01_notification_anatomy.png)\n\n</Column>\n</Row>\n\n1. **Icon:** Informs users of the type of notification at a glance.\n2. **Title:** Gives users a quick overview of the notification.\n3. **Message (optional):** Provides additional detail and actionable steps for the user to take.\n4. **Inline notification action (optional):** Ghost button that allows users to address the notification or navigates them to a page with further details.\n5. **Close button (optional):** Closes the notification.\n6. **Time stamp (optional):** Shows the time the toast notification was sent.\n\n## Content\n\nNotifications provide limited space for content, and therefore the content must be short and concise. A user should be able to quickly scan the notification, be apprised of the situation, and know what to do next.\n\n### Main elements\n\n#### Title\n\n- The title should be short and descriptive, explaining the most important piece of information.\n- When possible, communicate the main message using just the title.\n- Use a period only if the title is a full sentence.\n\n#### Body content\n\n- Be concise and avoid repeating or paraphrasing the title.\n- Limit content to one or two short sentences.\n- Explain how to resolve the issue by including any troubleshooting actions or next steps. You can include links within the notification body that redirect the user to next steps.\n\n#### Action\n\n- Keep labels concise and clearly indicate the action the user can take.\n- Limit action labels to one or two words. For a list of recommended action labels, see Carbon's [content guidelines](https://www.carbondesignsystem.com/guidelines/content/action-labels).\n\n### Overflow\n\nIf a toast or inline notification requires a message longer than two lines, include a short message with a “View more” link that takes the user to a view of the full notification message. This can be either a full page with more details or a modal.\n\nFor further content guidance, see Carbon's [content guidelines](/guidelines/content/general).\n\n## Inline notifications\n\n### Formatting\n\n<Row>\n<Column colLg={12}>\n\n![Example of inline notification with action button](images/02_notification_format_928_4up.png)\n\n</Column>\n</Row>\n\n#### Action\n\nInline notifications have an optional ghost button action that is adjacent to the title and body content. On mobile screens the action button wraps under the body content. This button should allow users to take further action on the notification.\n\n#### Sizing\n\nThe width of inline notifications varies based on content and layout. They can expand to the fill the container or content area they relate to. Their height is based on the content length, which should not exceed two lines of text.\n\n#### Placement\n\nInline notifications appear near their related items. They can expand to fill the width of the container or content area they are in and should align to the grid columns.\n\nWe recommend placing inline notifications at the bottom of forms, just above the submission and cancel buttons. When error notifications apply to individual text inputs, they should supplement the error state on that specific input field.\n\n<Row>\n<Column colLg={8}>\n\n![Example of inline notification placement](images/03_notification_placement_inline_608.png)\n\n<Caption>\n  Example of an inline notification supporting an error message on a form\n</Caption>\n\n</Column>\n</Row>\n\n### Behavior\n\n#### Dismissal\n\nInline notifications do not dismiss automatically. They persist on the page until the user dismisses them or takes action that resolves the notification.\n\nA small \"x\" in the top right corner is used to dismiss inline notifications. Including the close button is optional and should not be included if it is critical for a user to read or interact with the notification.\n\n## Toast notifications\n\n### Formatting\n\n<Row>\n<Column colLg={12}>\n\n![Example of toast notification with action button and time stamp](images/04_toast_format_928.png)\n\n</Column>\n</Row>\n\n#### Action\n\nCarbon toast notifications are not fully accessible when they include interactive content. Using links and other interactive content in toasts breaks WCAG 2.1 compliance and should therefore be avoided. The Carbon team is aware of the accessibility concerns and is currently working on deprecating this functionality.\n\n#### Time stamp\n\nToast notifications include a time stamp at the bottom the container. The time stamp shows the time the notification was sent. Using time stamps is optional but toasts should be consistent across the product so either all toasts should include time stamps or none of them should. The time stamp is optional and can be removed if a third line of content is needed.\n\n#### Sizing\n\nToast notifications use a fixed width and their height depends on the length of the notification message. As noted in the content guidelines, limit toast notifications to two lines of text.\n\n#### Placement\n\nToast notifications slide in and out from the top right of the screen. They stack with `$spacing-03` in-between. New toast notifications should appear at the top of the list, with older notifications being pushed down until they are dismissed.\n\nActionable toast notifications do not appear on mobile screen widths.\n\n<Row>\n<Column colLg={8}>\n\n![Example of toast notification placement](images/05_toast_context_608.png)\n\n</Column>\n</Row>\n\n### Behavior\n\n#### Dismissal\n\nToasts dismiss automatically after five seconds on the screen. They can also include a close button so users can dismiss them sooner. Toasts cover content on the screen so they should always be easily dismissed. Because toast notifications dismiss automatically, users must be able to access them elsewhere after the toast disappears. This allows them to be accessible for users who need more time reading the notification or who may want to refer back to the notification.\n\n## Modifiers\n\n### High and low contrast\n\nCarbon supports high and low contrast style notifications. High-contrast notifications are best for critical messaging while low-contrast notifications are less visually disruptive for users.\n\nIt's up to the product team to decide which notification style to use in their product. Inline and toast notifications can use different styles but you should never mix styles within each notification type. When in doubt, use low-contrast notifications.\n\n<Row>\n<Column colLg={8}>\n\n![High and low contrast inline notifications](images/06_notification_contrast_608.png)\n\n<Caption>\n    High contrast notification (top); low contrast notification (bottom)\n</Caption>\n</Column>\n</Row>\n\n## Related\n\n- [Modal component](https://www.carbondesignsystem.com/components/modal/usage/)\n- [Notifications pattern](https://www.carbondesignsystem.com/patterns/notification-pattern)\n\n## Feedback\n\nHelp us improve this pattern by providing feedback, asking questions, and leaving any other comments on [GitHub](https://github.com/carbon-design-system/carbon-website/issues/new?assignees=&labels=feedback&template=feedback.md).\n\n\n","type":"Mdx","contentDigest":"d16b8c17fb3cd5e3fba3d845a45d7603","counter":1516,"owner":"gatsby-plugin-mdx"},"frontmatter":{"title":"Notification","description":"Notifications are messages that communicate information to the user. The two main types of notifications are toast notifications and inline notifications.","tabs":["Code","Usage","Style"," Accessibility"]},"exports":{},"rawBody":"---\ntitle: Notification\ndescription: Notifications are messages that communicate information to the user. The two main types of notifications are toast notifications and inline notifications.\ntabs: [\"Code\", \"Usage\", \"Style\", \" Accessibility\"]\n---\n\n<PageDescription>\n\nNotifications are messages that communicate information to the user. The two main types of notifications are toast notifications and inline notifications.\n\n</PageDescription>\n\n<AnchorLinks>\n\n<AnchorLink>Overview</AnchorLink>\n<AnchorLink>Formatting</AnchorLink>\n<AnchorLink>Content</AnchorLink>\n<AnchorLink>Inline notifications</AnchorLink>\n<AnchorLink>Toast notifications</AnchorLink>\n<AnchorLink>Modifiers</AnchorLink>\n<AnchorLink>Related</AnchorLink>\n<AnchorLink>Feedback</AnchorLink>\n\n</AnchorLinks>\n\n## Overview\n\n### When to use\n\nUse notifications to inform users of updates or changes to system status. Communicating with users and providing immediate feedback are important for building trust. While notifications are an effective method of communicating with users, they are disruptive and should be used sparingly.\n\nFor more context on when to use each notification type, including modals, refer to the [notifications pattern](/patterns/notification-pattern/). Carbon currently only supports inline, toast, and modal notification types, although some product teams also support banners and notification centers.\n\n### Types\n\n| Type   | Purpose                                                                                                                                                          |\n| ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| Inline | Inline notifications show up in task flows, to notify users of the status of an action. They usually appear at the top of the primary content area.              |\n| Toast  | Toasts are non-modal, time-based window elements used to display short messages; they usually appear at the top of the screen and disappear after a few seconds. |\n\n## Formatting\n\n### Anatomy\n\n<Row>\n<Column colLg={8}>\n\n![notification anatomy image](images/01_notification_anatomy.png)\n\n</Column>\n</Row>\n\n1. **Icon:** Informs users of the type of notification at a glance.\n2. **Title:** Gives users a quick overview of the notification.\n3. **Message (optional):** Provides additional detail and actionable steps for the user to take.\n4. **Inline notification action (optional):** Ghost button that allows users to address the notification or navigates them to a page with further details.\n5. **Close button (optional):** Closes the notification.\n6. **Time stamp (optional):** Shows the time the toast notification was sent.\n\n## Content\n\nNotifications provide limited space for content, and therefore the content must be short and concise. A user should be able to quickly scan the notification, be apprised of the situation, and know what to do next.\n\n### Main elements\n\n#### Title\n\n- The title should be short and descriptive, explaining the most important piece of information.\n- When possible, communicate the main message using just the title.\n- Use a period only if the title is a full sentence.\n\n#### Body content\n\n- Be concise and avoid repeating or paraphrasing the title.\n- Limit content to one or two short sentences.\n- Explain how to resolve the issue by including any troubleshooting actions or next steps. You can include links within the notification body that redirect the user to next steps.\n\n#### Action\n\n- Keep labels concise and clearly indicate the action the user can take.\n- Limit action labels to one or two words. For a list of recommended action labels, see Carbon's [content guidelines](https://www.carbondesignsystem.com/guidelines/content/action-labels).\n\n### Overflow\n\nIf a toast or inline notification requires a message longer than two lines, include a short message with a “View more” link that takes the user to a view of the full notification message. This can be either a full page with more details or a modal.\n\nFor further content guidance, see Carbon's [content guidelines](/guidelines/content/general).\n\n## Inline notifications\n\n### Formatting\n\n<Row>\n<Column colLg={12}>\n\n![Example of inline notification with action button](images/02_notification_format_928_4up.png)\n\n</Column>\n</Row>\n\n#### Action\n\nInline notifications have an optional ghost button action that is adjacent to the title and body content. On mobile screens the action button wraps under the body content. This button should allow users to take further action on the notification.\n\n#### Sizing\n\nThe width of inline notifications varies based on content and layout. They can expand to the fill the container or content area they relate to. Their height is based on the content length, which should not exceed two lines of text.\n\n#### Placement\n\nInline notifications appear near their related items. They can expand to fill the width of the container or content area they are in and should align to the grid columns.\n\nWe recommend placing inline notifications at the bottom of forms, just above the submission and cancel buttons. When error notifications apply to individual text inputs, they should supplement the error state on that specific input field.\n\n<Row>\n<Column colLg={8}>\n\n![Example of inline notification placement](images/03_notification_placement_inline_608.png)\n\n<Caption>\n  Example of an inline notification supporting an error message on a form\n</Caption>\n\n</Column>\n</Row>\n\n### Behavior\n\n#### Dismissal\n\nInline notifications do not dismiss automatically. They persist on the page until the user dismisses them or takes action that resolves the notification.\n\nA small \"x\" in the top right corner is used to dismiss inline notifications. Including the close button is optional and should not be included if it is critical for a user to read or interact with the notification.\n\n## Toast notifications\n\n### Formatting\n\n<Row>\n<Column colLg={12}>\n\n![Example of toast notification with action button and time stamp](images/04_toast_format_928.png)\n\n</Column>\n</Row>\n\n#### Action\n\nCarbon toast notifications are not fully accessible when they include interactive content. Using links and other interactive content in toasts breaks WCAG 2.1 compliance and should therefore be avoided. The Carbon team is aware of the accessibility concerns and is currently working on deprecating this functionality.\n\n#### Time stamp\n\nToast notifications include a time stamp at the bottom the container. The time stamp shows the time the notification was sent. Using time stamps is optional but toasts should be consistent across the product so either all toasts should include time stamps or none of them should. The time stamp is optional and can be removed if a third line of content is needed.\n\n#### Sizing\n\nToast notifications use a fixed width and their height depends on the length of the notification message. As noted in the content guidelines, limit toast notifications to two lines of text.\n\n#### Placement\n\nToast notifications slide in and out from the top right of the screen. They stack with `$spacing-03` in-between. New toast notifications should appear at the top of the list, with older notifications being pushed down until they are dismissed.\n\nActionable toast notifications do not appear on mobile screen widths.\n\n<Row>\n<Column colLg={8}>\n\n![Example of toast notification placement](images/05_toast_context_608.png)\n\n</Column>\n</Row>\n\n### Behavior\n\n#### Dismissal\n\nToasts dismiss automatically after five seconds on the screen. They can also include a close button so users can dismiss them sooner. Toasts cover content on the screen so they should always be easily dismissed. Because toast notifications dismiss automatically, users must be able to access them elsewhere after the toast disappears. This allows them to be accessible for users who need more time reading the notification or who may want to refer back to the notification.\n\n## Modifiers\n\n### High and low contrast\n\nCarbon supports high and low contrast style notifications. High-contrast notifications are best for critical messaging while low-contrast notifications are less visually disruptive for users.\n\nIt's up to the product team to decide which notification style to use in their product. Inline and toast notifications can use different styles but you should never mix styles within each notification type. When in doubt, use low-contrast notifications.\n\n<Row>\n<Column colLg={8}>\n\n![High and low contrast inline notifications](images/06_notification_contrast_608.png)\n\n<Caption>\n    High contrast notification (top); low contrast notification (bottom)\n</Caption>\n</Column>\n</Row>\n\n## Related\n\n- [Modal component](https://www.carbondesignsystem.com/components/modal/usage/)\n- [Notifications pattern](https://www.carbondesignsystem.com/patterns/notification-pattern)\n\n## Feedback\n\nHelp us improve this pattern by providing feedback, asking questions, and leaving any other comments on [GitHub](https://github.com/carbon-design-system/carbon-website/issues/new?assignees=&labels=feedback&template=feedback.md).\n\n\n","fileAbsolutePath":"/zeit/3b23ef32/src/pages/components/notification/usage.mdx"}}}}