
npx create-react-app alertdemo
cd alertdemo
npm i notyf
Notyf is a minimalistic JavaScript library for toast notifications. It is responsive, A11Y compatible, dependency-free, and has a very lightweight footprint (~3KB). Notyf can be easily integrated with React, Angular, Aurelia, Vue, and Svelte.
<html>
<head>
...
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/notyf@3/notyf.min.css">
</head>
<body>
...
<script src="https://cdn.jsdelivr.net/npm/notyf@3/notyf.min.js"></script>
</body>
</html>// Create an instance of Notyf
var notyf = new Notyf();
// Display an error notification
notyf.error('You must fill out the form before moving forward');
// Display a success notification
notyf.success('Your changes have been successfully saved!');The following example configures Notyf with the following settings:
const notyf = new Notyf({
duration: 1000,
position: {
x: 'right',
y: 'top',
},
types: [
{
type: 'warning',
background: 'orange',
icon: {
className: 'material-icons',
tagName: 'i',
text: 'warning'
}
},
{
type: 'error',
background: 'indianred',
duration: 2000,
dismissible: true
}
]
});const notyf = new Notyf({
types: [
{
type: 'info',
background: 'blue',
icon: false
}
]
});
notyf.open({
type: 'info',
message: 'Send us <b>an email</b> to get support'
});import React from 'react'
import { Notyf } from 'notyf';
import 'notyf/notyf.min.css'; // for React, Vue and Svelte
function App() {
const notyf = new Notyf();
const successAlert = () => {
notyf.success("This is a basic Alert")
}
const errorAlert = () => {
let error = new Notyf({
duration:1000,
position:{
x:'right',
y:'top'
},
dismissible:true
})
error.error("This is an error Alert")
}
const customAlert = () => {
const notyf = new Notyf({
types: [
{
type: 'custom',
background: 'blue',
icon: false
}
]
});
notyf.open({
type: 'custom',
message: 'Send us <b>an email</b> to get support'
});
}
return (
<div>
<button onClick={successAlert}>Success Alert</button>
<button onClick={errorAlert}>Error Alert</button>
<button onClick={customAlert}>Custom Toast Alert</button>
</div>
)
}
export default AppGoogle Chrome has dominated web browsing for over a decade with 71.77% global market share.…
Perplexity just made its AI-powered browser, Comet, completely free for everyone on October 2, 2025.…
You've probably heard about ChatGPT Atlas, OpenAI's new AI-powered browser that launched on October 21,…
Perplexity Comet became free for everyone on October 2, 2025, bringing research-focused AI browsing to…
ChatGPT Atlas launched on October 21, 2025, but it's only available on macOS. If you're…
Two AI browsers just entered the ring in October 2025, and they're both fighting for…