Yoyo Toast

Dependency Free Customizable Light Weight Elegant Easy to Use
Example
Success Toast

yoyoToast.fire({

type: 'success',

title: 'Congratulation!',

message: 'Updated Successfully',

timeout: 3000,

position: 'top-right',

});

Installation
- Install via npm
Install Package

npm install yoyo-toast

- Install via yarn
Install Package

yarn add yoyo-toast

- Import (npm / yarn)
Import ES6 Module

import { yoyoToast } from './node_modules/yoyo-toast/dist/yoyoToast.min.mjs';

Include

<script src="./node_modules/yoyo-toast/dist/yoyoToast.umd.min.js"></script>

- Include via CDN
CDN

<!-- jsDelivr CDN -->

<script src="https://cdn.jsdelivr.net/gh/smallvi/yoyoToast@latest/dist/yoyoToast.umd.min.js"></script>


<!-- unpkg CDN -->

<script src="https://unpkg.com/yoyo-toast@latest/dist/yoyoToast.umd.min.js"></script>

- Self Hosted
Import ES6 Module

import { yoyoToast } from 'path/to/yoyoToast.min.mjs';

Include

<script src="path/to/yoyoToast.umd.min.js"></script>

Usage
Call the `yoyoToast` function after the page has loaded.
Simple Yoyo Toast

yoyoToast.fire({

type: 'danger',

message: 'Error Found!',

});

Advance Yoyo Toast

yoyoToast.fire({

type: 'info',

title: 'Update Available',

message: 'Update to 10.5.3!',

timeout: 10000,

subtext: '~ Info Yoyo Toast ~',

position: 'top-right',

timeoutFunction: () => alert('Timeout Function called'),

hasConfirmation: true,

confirmLabel: 'Right!',

confirmFunction: () => alert('Confirm Function called'),

hasCancellation: true,

cancelLabel: 'Not Now',

cancelFunction: () => alert('Cancel Function called'),

});

Params
Description

type

Optional

Icon type.

('info', 'question', 'success', 'warning', 'danger')

message

Mandatory

Main text displayed in the Toast

title

Optional

Title Text.

subtext

Optional

Additional text shown below the main text.

position

Optional

Display position

('top-left', 'top-right', 'bottom-left', 'bottom-right')

timeOut

Optional

Auto-close the Toast after a specified time.

(e.g., `1000` for 1 second)

timeoutFunction

Optional

function to call when timeout occurs.

hasConfirmation

Optional

Boolean indicating if the Toast includes a confirm button.

(true, false)

confirmLabel

Optional

Text label for the confirm button.

confirmFunction

Optional

Function to call when the confirm button is pressed.

hasCancellation

Optional

Boolean indicating if the Toast includes a cancel button.

(true, false)

cancelLabel

Optional

Text label for the cancel button.

cancelFunction

Optional

Function to call when the cancel button is pressed.

closeFunction

Optional

Function to call when the close button is pressed.