1.1.0 • Published 2 years ago

@polar/plugin-toast v1.1.0

Weekly downloads
-
License
EUPL-1.2
Repository
github
Last release
2 years ago

Toast

Scope

The toast plugin offers global functionality to display text messages to the user. These are the classic success, warning, info, and error messages, helping to understand what's going on or why something happened.

Configuration

Please check the vuetify documentation to override the success, warning, info, or errors colors in general. To affect only this plugin, the following configuration parameters can be added to either the plugin instantiation or the mapConfiguration:

toast

fieldNametypedescription
errortoastStyleDesign override for error messages.
warningtoastStyleDesign override for warning messages.
infotoastStyleDesign override for info messages.
successtoastStyleDesign override for success messages.

toast.toastStyle

fieldNametypedescription
color?stringEither a color code like '#FACADE' or a color string vuetify understands.
icon?stringCSS icon class.

Store

Actions

New entries are made via action. They are either dismissed after a timeout or by user interaction.

map.$store.dispatch('plugin/toast/addToast', payload)

Payload structure

fieldNametypedescription
typeenum'error', 'warning', 'info', 'success'Decides the default toast colouring and icon.
textstringTextual user information. This may either be a user-readable string or a translation key.
timeoutnumberAny positive non-null number will be used as ms until the toast is closed. 0 means no timeout.
color?stringSee {toast.toastStyle}. Overrides setting for this toast only.
icon?stringSee {toast.toastStyle}. Overrides setting for this toast only.

Usage example

map.$store.dispatch('plugin/toast/addToast', {
  type: 'warning',
  text: 'Wrong hammer for screw.',
  timeout: 5000,
})

Alert example

Due to its timeout, the message will automatically disappear after 5 seconds passed.

1.1.0

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago