Installations
npm install react-toasts
Developer Guide
Typescript
Yes
Module System
CommonJS
Node Version
12.11.1
NPM Version
6.11.3
Score
75
Supply Chain
92.9
Quality
75.9
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (80.09%)
CSS (10.48%)
JavaScript (9.43%)
Developer
Vashnak
Download Statistics
Total Downloads
727,211
Last Day
50
Last Week
1,152
Last Month
4,800
Last Year
76,859
GitHub Statistics
56 Stars
150 Commits
19 Forks
3 Watching
7 Branches
5 Contributors
Bundle Size
125.50 kB
Minified
40.31 kB
Minified + Gzipped
Package Meta Information
Latest Version
3.0.6
Package Id
react-toasts@3.0.6
Unpacked Size
132.50 kB
Size
43.04 kB
File Count
7
NPM Version
6.11.3
Node Version
12.11.1
Total Downloads
Cumulative downloads
Total Downloads
727,211
Last day
22%
50
Compared to previous day
Last week
-7.2%
1,152
Compared to previous week
Last month
3.3%
4,800
Compared to previous month
Last year
-26.5%
76,859
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Lightweight react toasts manager
react-toasts is a very simple and lightweight component to create toasts.
Demo url : https://vashnak.com/react-toasts/
How to use
1$ npm install -S react-toasts
You will need to import the ToastsContainer component and the ToastsStore.
1import {ToastsContainer, ToastsStore} from 'react-toasts'; 2 3function render(){ 4 return <div> 5 <button onClick={() => ToastsStore.success("Hey, you just clicked!")}>Click me</button> 6 <ToastsContainer store={ToastsStore}/> 7 </div> 8}
It is very easy to use. ToastsContainer is, as its name suggests, the toast container while ToastsStore is the toasts manager. The ToastsContainer must be linked to the ToastsStore, so we must set it as a parameter (see the code above). It will not work if you forget it!
Now you can simply call one of the 4 functions from the ToastStore (success, info, warning, error):
function n(message: string | HTMLElement, timer?: number = 3000, classNames?: string): void
Like this:
1ToastStore.success('Hey, it worked !');
The timer parameter is optional and its default value is 3000ms. The classNames parameter is also optional, if you have multiple classes to add, please separate them with a space ("class1 class2 ...").
The container can have 6 positions:
- TOP_RIGHT
- TOP_LEFT
- TOP_CENTER
- BOTTOM_RIGHT
- BOTTOM_LEFT
- BOTTOM_CENTER.
By default its position is BOTTOM_RIGHT. You can change it by using the enum ToastsContainerPosition
1<ToastContainer position={ToastsContainerPosition.TOP_LEFT}/>
If you want the toasts to have a light background, add the lightBackground
property to the ToastsContainer component.
1<ToastContainer position={ToastContainer.POSITION.TOP_LEFT} lightBackground/>
Updates
3.0.6
Prepared the package.json file to migrate from react-toasts to @vashnak/react-toasts (will be up with version 4.0.0)
3.0.5
Updated types, fix dependencies vulnerabilities, removed react/react-dom from dev-dependencies and added them into peerDependencies.
3.0.0
Rewrite with typescript, updated typos, optimized build, now support HTML in toast messages.
2.0.9
Can now add custom classes to toasts.
2.0.8
Added a class on each toasts.
2.0.7
Now support line break in toasts (\n).
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
Found 3/7 approved changesets -- score normalized to 4
Reason
0 commit(s) and 0 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
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
license file not detected
Details
- Warn: project does not have a license file
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 26 are checked with a SAST tool
Reason
28 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-x9w5-v3q2-3rhw
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq
- Warn: Project is vulnerable to: GHSA-434g-2637-qmqr
- Warn: Project is vulnerable to: GHSA-49q7-c7j4-3p7m
- Warn: Project is vulnerable to: GHSA-977x-g7h5-7qgw
- Warn: Project is vulnerable to: GHSA-f7q4-pwc6-w24p
- Warn: Project is vulnerable to: GHSA-fc9h-whq2-v747
- Warn: Project is vulnerable to: GHSA-4gmj-3p3h-gm8h
- Warn: Project is vulnerable to: GHSA-8r6j-v8pm-fqw3
- Warn: Project is vulnerable to: MAL-2023-462
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-6c8f-qphg-qjgp
- Warn: Project is vulnerable to: GHSA-76p3-8jx3-jpfq
- Warn: Project is vulnerable to: GHSA-3rfm-jhwj-7488
- Warn: Project is vulnerable to: GHSA-hhq3-ff78-jv3g
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m / GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-7fh5-64p2-3v2j
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-h9rv-jmmf-4pgx
- Warn: Project is vulnerable to: GHSA-hxcc-f52p-wc94
- Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36
- Warn: Project is vulnerable to: GHSA-4wf5-vphf-c2xc
- Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp
Score
1.8
/10
Last Scanned on 2024-12-16
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 MoreOther packages similar to react-toasts
react-toast-notifications
A configurable, composable, toast notification system for react.
react-simple-toasts
Instant, lightweight toast notifications for React. No providers or containers needed.
react-semantic-toasts
React Semantic UI alerts library
@alekna/react-toasts
Simple toasts for react.