Gathering detailed insights and metrics for @flrfinance/react-enotify
Gathering detailed insights and metrics for @flrfinance/react-enotify
React-Enotify is a customizable, easy-to-use notification library for React. With smooth animations powered by React Spring, it enhances user experience and responsiveness.
npm install @flrfinance/react-enotify
Typescript
Module System
Node Version
NPM Version
TypeScript (85.08%)
SCSS (13.48%)
JavaScript (1.44%)
Verify real, reachable, and deliverable emails with instant MX records, SMTP checks, and disposable email detection.
Total Downloads
2,429
Last Day
1
Last Week
2
Last Month
12
Last Year
803
MIT License
1 Stars
101 Commits
1 Watchers
1 Branches
1 Contributors
Updated on Oct 22, 2023
Minified
Minified + Gzipped
Latest Version
0.0.29
Package Id
@flrfinance/react-enotify@0.0.29
Unpacked Size
46.68 kB
Size
11.23 kB
File Count
66
NPM Version
10.1.0
Node Version
20.9.0
Published on
Jan 31, 2024
Cumulative downloads
Total Downloads
Last Day
0%
1
Compared to previous day
Last Week
-60%
2
Compared to previous week
Last Month
-74.5%
12
Compared to previous month
Last Year
-50.6%
803
Compared to previous year
1
21
React-Enotify is a lightweight, customizable notification library for React applications. It provides an easy-to-use hook and context for managing notifications, along with smooth animations powered by React Spring. With React-Enotify, you can quickly integrate and manage notification pop-ups in your application, enhancing user experience and responsiveness.
To install react-enotify
, you can use npm:
1npm install --save @flrfinance/react-enotify
Or yarn:
1yarn add @flrfinance/react-enotify
To use the Notifications module, follow these steps:
NotificationsProvider
component:1import { NotificationsProvider } from "@flrfinance/react-enotify"; 2 3function App() { 4 return ( 5 <NotificationsProvider> 6 <div>...Your app goes here...</div> 7 </NotificationsProvider> 8 ); 9}
1import { useNotifications } from "@flrfinance/react-enotify"; 2 3function MyComponent() { 4 const { addNotification, removeNotification } = useNotifications(); 5 6 const handleClick = () => { 7 addNotification({ 8 id: "my-notification", 9 title: "Notification title", 10 description: "Notification description", 11 status: "success", // success, info, warning, error 12 dismissible: true, // optional 13 dismissAfter: 3000, // optional, in milliseconds 14 primaryAction: { 15 label: "Ok", 16 onClick: () => { 17 removeNotification("my-notification"); 18 }, 19 }, // optional 20 secondaryAction: { 21 label: "Cancel", 22 onClick: () => { 23 removeNotification("my-notification"); 24 }, 25 }, // optional 26 }); 27 }; 28 29 return <button onClick={handleClick}>Add Notification</button>; 30}
The addNotification
method expects a notification object with the following properties:
id
(string, required): unique identifier for the notificationtitle
(string, required): title of the notificationdescription
(string, required): description of the notificationstatus
(string, required): status of the notification, can be one of: success, info, warning or errordismissible
(boolean, optional): whether the notification can be dismissed or not (defaults to false)dismissAfter
(number, optional): the time in milliseconds after which the notification should be automatically dismissed (defaults to null)primaryAction
(object, optional): an object with label
and onClick
properties defining a primary action for the notification (defaults to null)secondaryAction
(object, optional): an object with label
and onClick
properties defining a secondary action for the notification (defaults to null)The removeNotification
method expects the id of the notification to be removed as a parameter.
You can customize the appearance of notifications by overriding the default styles. Here's an example:
1// Override the background color of the success notifications 2.r-enotification.success { 3 background-color: #b2e2b2; 4} 5 6// Override the background color of the error notifications 7.r-enotification.error { 8 background-color: #e2b2b2; 9}
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
No vulnerabilities found.
No security vulnerabilities found.