Socket
Socket
Sign inDemoInstall

toastify

Package Overview
Dependencies
0
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    toastify

Javascript toaster notifications without any dependencies


Version published
Weekly downloads
1.7K
decreased by-5.78%
Maintainers
1
Install size
25.8 kB
Created
Weekly downloads
 

Readme

Source

Toastify

Build Status npm version npm

Toastify is a lightweight Javascript package written in Typescript. It was created to provide toaster style notifications without any dependencies.

View the blog article here - Zero Dependency Toaster Notifications

Installation

You can install this package by simply running npm install --save toastify or yarn add toastify.

Once this has finished, you can import the package. Below is an example:

import Toastify from "toastify";

Usage

The Toastify package allows you to fire different levels of notifications. At present you can fire: default, info, success, error and warning. To do this you simply call the respective method. For example, to fire a success notification you would do the following:

Toastify.success('Title', 'This is the body of the notification');

As you can see, the first parameter is the title of the notification. The second parameter is the body, which is totally optional.

Configuration

There are a small number of options you can configure in this package. These are the position, delay, element and speed.

To set an option, you can simply call the setOption method. Here is an example:

Toastify.setOption('delay', 10000);

Position

By default, the position is set to bottom-right. However you can alter this to one of the following if you wish: top-left, top-right, bottom-left.

Delay

The delay value determines how long this notification appears on screen before it disappears. The default value is 5 seconds (5000ms). You can alter this to any number you wish.

Speed

The speed value determines how fast the animation is when fading in and fading out notifications. The default speed is 20 - however you can adjust this to suit your needs.

FAQs

Last updated on 09 Jun 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc