Toast
Basic toast. Toasts are stacked on top of each other
// simplest possible
Toast.show('Just toasting');
// with config
Toast.show({
html : 'Well toasted',
showProgress : false
});
// as instance (instance is also returned from Toast.show()
const toast = new Toast({
html : 'Not going away',
timeout : 0
});
toast.show();
To show toasts from the top and have them stack downwards, specify side as 'top':
Toast.show({
html : 'Well toasted',
side : 'top'
});
By default, Toasts show at the inline-end side of the screen, so on the right in LTR environments
and on the left in RTL environments.
Append -start to the side to display at the required edge, or just use side : 'start' to show
at the bottom but at the inline-start side of the screen.
Toast.show({
html : 'Well toasted on the left',
side : 'start'
});
//<code-header>
fiddle.title = 'Toast';
//</code-header>
// button that shows a toast with random text when clicked
new Button({
appendTo : targetElement,
text : 'Show toast',
onClick : () => {
const greetings = ['Hello', 'Hey', 'Hi', 'Greetings', 'Good day'];
Toast.show(greetings[Math.floor(Math.random() * 5)]);
}
});Configs
77
Configs
77Common
Other
Show a progress bar indicating the time remaining until the toast is dismissed.
Which side to show the toast at, 'top' or 'bottom'. Defaults to 'bottom'.
May also define the inline edge to show at, by using 'top-start', or 'top-end' etc.
By default, toasts are shown at the bottom at the inline-end edge.
Timeout (in ms) until the toast is automatically dismissed. Set to 0 to never hide.
DOM
Float & align
Layout
Misc
Scrolling
Properties
65
Properties
65Class hierarchy
CSS
DOM
Layout
Misc
Functions
60
Functions
60Other
Hide the toast
Hide all visible toasts
Show the toast
Easiest way to show a toast
Toast.show('Hi');
Toast.show({
html : 'Read quickly, please',
timeout: 1000
});
| Parameter | Type | Description |
|---|---|---|
config | String | ToastConfig | Message or toast config object |
Configuration
Events
Misc
Widget hierarchy
Events
14
Events
14Event handlers
14
Event handlers
14Typedefs
6
Typedefs
6CSS variables
27
CSS variables
27| Name | Description |
|---|---|
--b-toast-padding | Toast padding |
--b-toast-border-radius | Toast border radius |
--b-toast-transition-duration | Toast transition duration |
--b-toast-progress-height | Toast progress bar height |
--b-toast-color | Toast color |
--b-toast-background | Toast background |
--b-toast-progress-color | Toast progress bar color |