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'
});

Toast
//<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

Common

listenersEvents

Other

showProgress: Boolean= true

Show a progress bar indicating the time remaining until the toast is dismissed.

side: top | bottom | start | end | top-start | top-end | bottom-start | bottom-end

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: Number= 2500

Timeout (in ms) until the toast is automatically dismissed. Set to 0 to never hide.

columnWidget
rtlRTL
spanWidget

Accessibility

ariaLabelWidget
keyMapKeyMap

CSS

clsWidget
colorWidget
htmlClsWidget
styleWidget
uiWidget

DOM

adoptWidget
appendToWidget
contentWidget
datasetWidget
htmlWidget
idWidget
tagWidget
titleWidget

Float & align

alignWidget
anchorWidget
centeredWidget
draggableWidget
floatingWidget
xWidget
yWidget

Layout

alignSelfWidget
dockWidget
flexWidget
heightWidget
hiddenWidget
marginWidget
maxHeightWidget
maxWidthWidget
minHeightWidget
minWidthWidget
textAlignWidget
weightWidget
widthWidget

Misc

dataFieldWidget
disabledWidget
localeClassLocalizable
localizableLocalizable
maskedWidget
ownerWidget
readOnlyWidget
refWidget
rippleWidget
tabWidget
tooltipWidget

Scrolling

Properties

65

Class hierarchy

isToast: Boolean= truereadonly
Identifies an object as an instance of Toast class, or subclass thereof.
isToast: Boolean= truereadonlystatic
Identifies an object as an instance of Toast class, or subclass thereof.
isDelayableDelayable
isEventsEvents
isKeyMapKeyMap
isLocalizableLocalizable
isWidgetWidget

Accessibility

keyMapKeyMap

CSS

clsWidget

DOM

appendToWidget
contentWidget
datasetWidget
elementWidget
htmlWidget
idWidget
styleWidget

Float & align

xWidget
yWidget

Layout

alignSelfWidget
flexWidget
heightWidget
marginWidget
maxHeightWidget
maxWidthWidget
minHeightWidget
minWidthWidget
widthWidget

Lifecycle

configBase

Misc

cellInfoWidget
disabledWidget
localeHelperLocalizable
localeManagerLocalizable
readOnlyWidget
refWidget
tabWidget
tooltipWidget

Other

$namestaticWidget
columnWidget
rtlRTL
spanWidget
typestaticWidget

Visibility

hiddenWidget
isVisibleWidget

Widget hierarchy

ownerWidget
parentWidget

Functions

60

Other

Hide the toast

hideAllstatic

Hide all visible toasts

Show the toast

showstatic

Easiest way to show a toast

Toast.show('Hi');

Toast.show({
  html   : 'Read quickly, please',
  timeout: 1000
});
ParameterTypeDescription
configString | ToastConfig

Message or toast config object

Returns: Toast
composeWidget
createOnFrameDelayable
disableWidget
enableWidget
focusWidget
LstaticLocalizable
maskWidget
onEvents
recomposeWidget
relayAllEvents
triggerEvents
unEvents
unmaskWidget

Configuration

applyDefaultsstaticBase

Events

Float & align

alignToWidget
setXYWidget
showByWidget
toFrontWidget

Lifecycle

createstaticWidget
destroystaticBase
initClassstaticWidget

Misc

attachTooltipstaticWidget
fromElementstaticWidget
fromSelectorstaticWidget
getByIdstaticWidget
isOfTypeNamestaticBase
mixinstaticBase
optionalLstaticLocalizable

Widget hierarchy

closestWidget
containsWidget
ownsWidget
queryWidget
queryAllWidget
upWidget

Events

14
catchAllEvents
destroyEvents
focusInWidget
focusOutWidget
hideWidget
paintWidget
readOnlyWidget
recomposeWidget
resizeWidget
showWidget

Event handlers

14

Typedefs

6

CSS variables

27
NameDescription
--b-toast-paddingToast padding
--b-toast-border-radiusToast border radius
--b-toast-transition-durationToast transition duration
--b-toast-progress-heightToast progress bar height
--b-toast-colorToast color
--b-toast-backgroundToast background
--b-toast-progress-colorToast progress bar color

Inherited