![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
toasted-notes
Advanced tools
A simple but flexible implementation of toast style notifications for React extracted from Sancho UI.
View the demo and documentation.
Install toasted-notes
and its peer dependency, react-spring
, using yarn or npm.
yarn add toasted-notes react-spring
import toaster from "toasted-notes";
import "toasted-notes/src/styles.css"; // optional styles
const HelloWorld = () => (
<button
onClick={() => {
toaster.notify("Hello world", {
duration: 2000
});
}}
>
Say hello
</button>
);
The notify function accepts either a string, a react node, or a render callback.
// using a string
toaster.notify("With a simple string");
// using jsx
toaster.notify(<div>Hi there</div>);
// using a render callback
toaster.notify(({ onClose }) => (
<div>
<span>My custom toaster</span>
<button onClick={onClose}>Close me please</button>
</div>
));
It also accepts options.
toaster.notify("Hello world", {
position: "bottom-left", // top-left, top, top-right, bottom-left, bottom, bottom-right
duration: null // This notification will not automatically close
});
One downside to the current API is that render callbacks and custom nodes won't get access to any application context, such as theming variables provided by styled-components. To ensure that render callbacks have access to the necessary context, you'll need to supply that context to the callback.
const CustomNotification = ({ title }) => {
const theme = useTheme();
return <div style={{ color: theme.primary }}>{title}</div>;
};
const CustomNotificationWithTheme = withTheme(CustomNotification);
toaster.notify(() => <CustomNotificationWithTheme title="I am pretty" />);
MIT
Way back, this was originally based on the wonderful implementation of notifications in evergreen.
FAQs
Flexible, easy to implement toast notifications for react
The npm package toasted-notes receives a total of 100 weekly downloads. As such, toasted-notes popularity was classified as not popular.
We found that toasted-notes demonstrated a not healthy version release cadence and project activity because the last version was released 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.