Gathering detailed insights and metrics for toastify-js
Gathering detailed insights and metrics for toastify-js
Gathering detailed insights and metrics for toastify-js
Gathering detailed insights and metrics for toastify-js
@types/toastify-js
TypeScript definitions for toastify-js
react-toastify
React notification made easy
toastify-react-native
🎉 toastify-react-native allows you to add notifications to your react-native app (ios, android) with ease. No more nonsense!
toastify
Javascript toaster notifications without any dependencies
npm install toastify-js
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
2,222 Stars
125 Commits
235 Forks
26 Watching
2 Branches
29 Contributors
Updated on 27 Nov 2024
Minified
Minified + Gzipped
JavaScript (81.74%)
CSS (11.61%)
HTML (6.65%)
Cumulative downloads
Total Downloads
Last day
5.4%
9,940
Compared to previous day
Last week
0.1%
48,972
Compared to previous week
Last month
14.6%
207,646
Compared to previous month
Last year
31.7%
2,169,299
Compared to previous year
No dependencies detected.
Toastify is a lightweight, vanilla JS toast notification library.
npm install --save toastify-js
or
yarn add toastify-js -S
import Toastify from 'toastify-js'
You can use the default CSS from Toastify as below and later override it or choose to write your own CSS.
import "toastify-js/src/toastify.css"
To start using Toastify, add the following CSS on to your page.
1<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/toastify-js/src/toastify.min.css">
And the script at the bottom of the page
1<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/toastify-js"></script>
Files are delivered via the CDN service provided by jsdeliver
1Toastify({ 2 text: "This is a toast", 3 duration: 3000, 4 destination: "https://github.com/apvarun/toastify-js", 5 newWindow: true, 6 close: true, 7 gravity: "top", // `top` or `bottom` 8 position: "left", // `left`, `center` or `right` 9 stopOnFocus: true, // Prevents dismissing of toast on hover 10 style: { 11 background: "linear-gradient(to right, #00b09b, #96c93d)", 12 }, 13 onClick: function(){} // Callback after click 14}).showToast();
Toast messages will be centered on devices with screen width less than 360px.
If you want to use custom classes on the toast for customizing (like info or warning for example), you can do that as follows:
1Toastify({ 2 text: "This is a toast", 3 className: "info", 4 style: { 5 background: "linear-gradient(to right, #00b09b, #96c93d)", 6 } 7}).showToast();
Multiple classes also can be assigned as a string, with spaces between class names.
If you want to add offset to the toast, you can do that as follows:
1Toastify({ 2 text: "This is a toast with offset", 3 offset: { 4 x: 50, // horizontal axis - can be a number or a string indicating unity. eg: '2em' 5 y: 10 // vertical axis - can be a number or a string indicating unity. eg: '2em' 6 }, 7}).showToast();
Toast will be pushed 50px from right in x axis and 10px from top in y axis.
Note:
If position
is equals to left
, it will be pushed from left.
If gravity
is equals to bottom
, it will be pushed from bottom.
Option Key | type | Usage | Defaults |
---|---|---|---|
text | string | Message to be displayed in the toast | "Hi there!" |
node | ELEMENT_NODE | Provide a node to be mounted inside the toast. node takes higher precedence over text | |
duration | number | Duration for which the toast should be displayed. -1 for permanent toast | 3000 |
selector | string | ELEMENT_NODE | ShadowRoot | CSS Selector or Element Node on which the toast should be added |
destination | URL string | URL to which the browser should be navigated on click of the toast | |
newWindow | boolean | Decides whether the destination should be opened in a new window or not | false |
close | boolean | To show the close icon or not | false |
gravity | "top" or "bottom" | To show the toast from top or bottom | "top" |
position | "left" or "right" | To show the toast on left or right | "right" |
backgroundColor | CSS background value | To be deprecated, use style.background option instead. Sets the background color of the toast | |
avatar | URL string | Image/icon to be shown before text | |
className | string | Ability to provide custom class name for further customization | |
stopOnFocus | boolean | To stop timer when hovered over the toast (Only if duration is set) | true |
callback | Function | Invoked when the toast is dismissed | |
onClick | Function | Invoked when the toast is clicked | |
offset | Object | Ability to add some offset to axis | |
escapeMarkup | boolean | Toggle the default behavior of escaping HTML markup | true |
style | object | Use the HTML DOM Style properties to add any style directly to toast | |
ariaLive | string | Announce the toast to screen readers, see https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions for options | "polite" |
oldestFirst | boolean | Set the order in which toasts are stacked in page | true |
Deprecated properties:
backgroundColor
- usestyle.background
option instead
IE / Edge | Firefox | Chrome | Safari | Opera |
---|---|---|---|---|
IE10, IE11, Edge | last 10 versions | last 10 versions | last 10 versions | last 10 versions |
MIT © Varun A P
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 9/18 approved changesets -- score normalized to 5
Reason
0 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More