Non-modal dialog used to communicate the status of a task or process.
CdrToast is a type of non-modal dialog used to communicate the status of a task or process. A proper toast is concise, time-relevant, and temporary.
There are five different options for styling the toast, based on the message type.
A toast should be passed a contextually appropriate icon using the icon-left
slot.
CdrToast provides an optional autoDismiss
property to disable the auto-dismiss functionality.
CdrToast provides an optional dismissDelay
property to adjust timing of the automatic dismissal under certain conditions, such as when the toast contains an action.
role="status"
to expose the notification to Accessibility APIsMany WCAG requirements are contextual to their implementation. To ensure that usage of this component complies with accessibility guidelines you are responsible for the following:
There are five information types supported for toasts: error, warning, success, informational, and default. Each type corresponds with a color and icon to provide a consistent, universal experience for users.
Use to inform that something went wrong. They affect or block the user's experience and must be resolved before moving forward.
Use for a message requiring attention but not resolution in order to continue. Warning toasts might tell a user what could happen if they don’t address what they’re being warned about.
Use to communicate that an action has been successfully completed. Provides a positive response to user actions. No action is required.
Use to provide context around a situation. No action is required.
Use to provide generic messaging that does not fit the other types
type
name
string
type
'default'
default
Sets the toast style. Possible values: { 'info' | 'success' | 'warning' | 'error' | 'default'}
open
name
boolean
type
false
default
Used to programmatically control the toast open/close state
autoDismiss
name
boolean
type
true
default
If set to `false`, the toast will not automatically close after the set interval
dismissDelay
name
number
type
5000
default
Used to change the interval (in milliseconds) before the toast automatically closes
Find more information about using Slots in the article Installing Cedar.
default
name
Slot for notification content
icon-left
name
Slot for icon matching toast messaging type
open
name
event
arguments
$emit event fired when opening the toast
closed
name
event
arguments
$emit event fired when closing the toast
CdrToast component(s) should be positioned in the top-right corner of the viewport. On smaller screens, they should appear at the top of the page and span the whole width of the viewport.
The CdrToast container should be be given an appropriate z-index
value so that the toast components within will "float" on top of the other page elements.
If multiple CdrToast components are present, they should appear stacked with the newest at the bottom. Note: When a toast is closed, any toast components below it will take the place of the one above.