
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
react-notifications-cascade
Advanced tools
A flexible notification system with action button support, configurable duration, and backwards compatibility built with React and Material UI
A sleek, animated notifications system built with React and Material UI that displays notifications in the bottom-right corner of the screen, animates them upward in a cascade style, and automatically removes them after 5 seconds.
# Using npm
npm install react-notifications-cascade
# Using yarn
yarn add react-notifications-cascade
# Using pnpm
pnpm add react-notifications-cascade
This package requires the following peer dependencies:
# Using npm
npm install react react-dom @mui/material @mui/icons-material @emotion/react @emotion/styled
# Using yarn
yarn add react react-dom @mui/material @mui/icons-material @emotion/react @emotion/styled
# Using pnpm
pnpm add react react-dom @mui/material @mui/icons-material @emotion/react @emotion/styled
In your root component (typically App.js), wrap your application with the NotificationsProvider:
import { NotificationsProvider } from 'react-notifications-cascade';
function App() {
return (
<NotificationsProvider>
{/* Your app components */}
</NotificationsProvider>
);
}
export default App;
Use the useNotifications hook to access notification functions:
import { useNotifications } from 'react-notifications-cascade';
function MyComponent() {
const { showSuccess, showError, showWarning, showInfo } = useNotifications();
const handleSaveSuccess = () => {
showSuccess('Data saved successfully!');
};
const handleApiError = () => {
showError('Failed to connect to the server. Please try again.');
};
return (
<div>
<button onClick={handleSaveSuccess}>Save Data</button>
<button onClick={handleApiError}>Simulate Error</button>
<button onClick={() => showWarning('Battery is low!')}>Show Warning</button>
<button onClick={() => showInfo('New updates available')}>Show Info</button>
</div>
);
}
The package includes a ready-to-use demo component for testing or showcasing purposes:
import { NotificationsProvider } from 'react-notifications-cascade';
import { NotificationsDemo } from 'react-notifications-cascade/demo';
function App() {
return (
<NotificationsProvider>
<NotificationsDemo />
{/* Your other app components */}
</NotificationsProvider>
);
}
The main provider component that makes notifications available throughout your app.
children - React nodes to be wrapped by the providerA custom hook for accessing notification functions.
An object containing:
notifications - Array of current notification objectsaddNotification(message, type) - Add a custom notificationremoveNotification(id) - Remove a notification by IDshowSuccess(message) - Show a success notificationshowError(message) - Show an error notificationshowWarning(message) - Show a warning notificationshowInfo(message) - Show an info notificationEach notification has the following properties:
{
id: string; // Unique identifier
message: string; // Notification message
type: string; // 'success' | 'error' | 'warning' | 'info'
timestamp: Date; // When the notification was created
}
To change the auto-dismissal duration, modify the timeout value in the addNotification function:
// Change from 5000ms (5 seconds) to your desired duration
setTimeout(() => {
removeNotification(newNotification.id);
}, 5000); // ← Modify this value
The notifications use Material UI's Alert and Snackbar components. You can customize their appearance by modifying the sx prop in the NotificationsContainer component.
import { useNotifications } from 'react-notifications-cascade';
function UserForm() {
const { showSuccess, showError } = useNotifications();
const handleSubmit = async (e) => {
e.preventDefault();
try {
// API call to save user data
await saveUserData(userData);
showSuccess('User profile updated successfully!');
} catch (error) {
showError(`Failed to update profile: ${error.message}`);
}
};
return (
<form onSubmit={handleSubmit}>
{/* form fields */}
<button type="submit">Update Profile</button>
</form>
);
}
This package includes TypeScript declarations for improved developer experience.
// Example TypeScript usage
import { useNotifications } from 'react-notifications-cascade';
import { FC, FormEvent } from 'react';
interface UserData {
name: string;
email: string;
}
const UserForm: FC = () => {
const { showSuccess, showError } = useNotifications();
const handleSubmit = async (e: FormEvent) => {
e.preventDefault();
try {
// API call
showSuccess('Success!');
} catch (err) {
showError(`Error: ${err instanceof Error ? err.message : String(err)}`);
}
};
return <form onSubmit={handleSubmit}>...</form>;
};
react-notifications-cascade is compatible with all modern browsers and React 16.8 or higher (requires Hooks support).
MIT
Contributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)FAQs
A flexible notification system with action button support, configurable duration, and backwards compatibility built with React and Material UI
We found that react-notifications-cascade demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.