Gathering detailed insights and metrics for react-awesome-toasts
Gathering detailed insights and metrics for react-awesome-toasts
Gathering detailed insights and metrics for react-awesome-toasts
Gathering detailed insights and metrics for react-awesome-toasts
@zendeskgarden/react-notifications
Notification and Well components within the Garden Design System
burnt
Cross-platform toasts, powered by native elements.
preact
Fast 3kb React-compatible Virtual DOM library.
react-simple-toasts
Instant, lightweight toast notifications for React. No providers or containers needed.
npm install react-awesome-toasts
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
61 Stars
58 Commits
2 Forks
1 Watching
19 Branches
1 Contributors
Updated on 14 Mar 2024
Minified
Minified + Gzipped
TypeScript (72.13%)
CSS (17.3%)
JavaScript (9.92%)
HTML (0.66%)
Cumulative downloads
Total Downloads
Last day
-21.9%
50
Compared to previous day
Last week
21.7%
370
Compared to previous week
Last month
8.2%
1,632
Compared to previous month
Last year
-36.7%
19,077
Compared to previous year
Easily customizable React notification system that manages its queue for you.
https://bananabobby.github.io/react-awesome-toasts/
Install the package:
yarn add react-awesome-toasts
// or
npm install react-awesome-toasts
Wrap your app with ToastProvider
:
import { ToastProvider } from 'react-awesome-toasts';
const App = () => {
return (
<ToastProvider>
App content
</ToastProvider>
)
}
Add toast methods to your component with one of the following methods:
With High Order Component:
import { withToast } from 'react-awesome-toasts';
const ToastButton = ({ toast }) => {
const toastProps = {
text: 'Message sent',
actionText: 'Undo',
ariaLabel: 'Message sent, click to undo',
onActionClick: toast.hide,
};
return <Button onClick={() => toast.show(toastProps)}>Show toast</Button>;
}
export default withToast(ToastButton);
With ToastConsumer:
import { ToastConsumer } from 'react-awesome-toasts';
const toastProps = {
text: 'Message sent',
actionText: 'Undo',
ariaLabel: 'Message sent, click to undo',
};
<ToastConsumer>
{
({ show, hide }) => (
<Button onClick={() => show({ ...toastProps, onActionClick: hide )}>
Show toast
</Button>
)
}
</ToastConsumer>
hide()
- hides currently active toast.
show(props)
- shows a toast and passes all props to the presentational component
By default ToastProvider
uses Toast
component provided by the library.
Toast
component is responsible for the accessibility and responsiveness of notifications.
Keep in mind, that if your replace it with your custom component - you will have to handle both of these features in your component if you need them in your app.
Default Toast
component has follow properties:
Property | Description |
---|---|
text string , required | Message to display in notification |
actionText string | Text of the action button |
onActionClick func | Action button click handler |
ariaLabel string | Default: text property value. Should be used for better accessibility. |
variant "error" | Variant of message |
Default presentational Toast
component provides accessibility features:
ariaLabel
value. Since action button gets focused automatically - it's nice to have an aria-label that mentions it, e.g. `Item deleted, click to undo.ToastProvider
accepts properties for customizing the behaviour of the notifications.
Property | Description |
---|---|
timeout number | Default: 4500 . The time until a toast is dismissed, in milliseconds. |
component | Presentational component for displaying notifications. |
position top-right, bottom-right, top-left, bottom-left, top-center, bottom-center | Default: bottom-left . Position of the toasts on the screen. |
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 0/28 approved changesets -- score normalized to 0
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
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
91 existing vulnerabilities detected
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