iziToast Documentation

repository·master·Indexed 25 days ago

https://github.com/marcelodolza/izitoast

A lightweight, responsive, and flexible notification plugin with no dependencies. Version 1.5.0 features theme methods for info, success, warning, error, and question notifications, customizable positions, and support for wrappers in Angular 2 and Vue 2. Includes APIs for global settings, lifecycle callbacks, and progress bar control.

Tokens
881
Snippets
4
Records
10
Agent score
33%

What's inside iziToast

  1. Get or set specific toast settings

    master

    You can interact with the settings of a specific, already-rendered toast instance using its reference.

    • $iziToast.setSetting(ref, option, value): Updates a specific option for a toast identified by ref.
    • $iziToast.getSettings(ref, option): Retrieves a specific option or the entire settings object for a toast identified by ref.
  2. Control progress bar playback

    master

    For toasts with a progress bar, you can control the timer using the .progress() method on the iziToast instance. This returns an object with the following methods:

    • start(): Starts or resumes the progress bar timer.
    • pause(): Pauses the progress bar timer.
    • resume(): Resumes the progress bar timer.
    • reset(): Resets the progress bar to 100% and clears the timer.
  3. Show a notification using theme methods

    master

    iziToast provides shorthand methods for common notification types. These methods automatically apply theme-specific colors and icons. The available theme methods are:

    • iziToast.info(options)
    • iziToast.success(options)
    • iziToast.warning(options)
    • iziToast.error(options)
    • iziToast.question(options)
  4. Configure iziToast notification options

    master

    When calling a theme method (like iziToast.success()), you can pass an options object to customize the toast.

    Common Options:

    • id: Custom string ID for the toast.
    • title: The text for the title.
    • message: The text for the message.
    • position: 'bottomRight', 'bottomLeft', 'bottomCenter', 'topRight', 'topLeft', 'topCenter', or 'center'.
    • theme: 'light' or 'dark'.
    • color: Custom color (hex, rgb, hsl) or theme color (e.g., 'blue', 'red', 'green', 'yellow').
    • timeout: Duration in milliseconds before the toast closes (default: 5000).
    • close: Boolean to show/hide the close button (default: true).
    • progressBar: Boolean to show a progress bar (default: true).
    • transitionIn: Animation for entering (e.g., 'fadeInUp', 'bounceInLeft').
    • transitionOut: Animation for exiting (e.g., 'fadeOut').
    • overlay: Boolean to show a background overlay (default: false).
    • buttons: Array of arrays defining buttons: ['Label', callback, focus_boolean].
    • inputs: Array of arrays defining inputs: [input_config, event_type, callback, focus_boolean].
    • onOpening, onOpened, onClosing, onClosed: Lifecycle callback functions.