Skip to main content

Toast

Availability

This feature will be available with Shopware 6.6.2.0.

Dispatch a toast

toast example

Usage:

function alertYes() {
alert('Yes');
}

sw.toast.dispatch({
msg: 'Your message',
dismissible: true,
type: 'positive',
action: {
label: 'action',
callback: alertYes
},
})

Parameters:

NameRequiredDefaultDescription
msgtrueDefines a toast's main expression or message to the user.
typetrueDefines the toast type. Available types are positive, informal and critical.
icon falseNoneA icon that should be displayed in front of your message.
dismissiblefalsefalseSpecifies if the toast can be manually dismmissed.
actionfalseNoneAdds a clickable button to the toast. The button receives a label and a callback wichs is called once clicked.

Return value:

Returns a promise without data.