Skip to content

Options

Dionlee Uy edited this page Apr 19, 2023 · 1 revision

You can add options when calling mdtoast() to fit your needs. Below are the options you can use:

Option Defaut Description
init false Determines if toast is initialize-only (meaning toast will not show unless show() is called
duration 5000 Determines the toast display duration (in milliseconds).
type default Determines the type of toast to display. Other types in mdtoast: INFO, WARNING, SUCCESS, ERROR.
Or you can just type these string values: info, warning, success, error.
position bottom left Determines the position of the toast on the screen.
Acceptable values: top left, top center, top right, bottom left, bottom center, bottom right.
modal false Determines if toast is modal (pointer events on other elements will be disabled).
interaction false Determines if toast requires user interaction to dismiss or has some sort of user interaction button to click.
interactionTimeout null Determines the toast duration (timeout to dismiss) if interaction is set to true. This overrides the duration option if interaction is set to true.
actionText OK The action text to display for user interaction (e.g. UNDO -> showing toast after archiving items and giving the user an option to undo archiving.)
action hide() This will be the function to be called when the user clicks the action text. The default calls the toast's hide() method.
callbacks {} You can place the callbacks hidden() and shown() in this option if you have some things to do after the toast is shown or hidden.
Clone this wiki locally