Compact, easy-to-use toast notifications for React
⚡ Lightweight • ⚙️ Headless Architecture • 🎯 Intuitive API • ✨ Fully Customizable
💡 Tip: Click buttons to test different toast features and configurations
npm install react-compact-toast
yarn add react-compact-toast
pnpm add react-compact-toast
import { ToastContainer, toast } from 'react-compact-toast';
function App() {
return (
<div>
<ToastContainer />
<Component />
</div>
);
}
function Component() {
return (
<div>
<button onClick={() => {
toast({ text: "super easy!", position: "topRight" });
}>
click me
</button>
</div>
);
}
// Custom toast with options
toast({
text: 'Custom notification',
icon: <Icon />,
highlightText: 'Custom',
highlightColor: '#FF6B6B',
autoClose: 5000,
closeOnClick: true,
position: 'topRight',
offset: '80px',
className: 'bg-gradient-to-r from-blue-500 to-purple-600 text-white rounded-2xl'
};
// Available positions:
// 'topLeft' | 'topCenter' | 'topRight' |
// 'bottomLeft' | 'bottomCenter' | 'bottomRight'
🎯 Pro Tip: You can fully style your toasts using className
— Tailwind, Emotion, Vanilla CSS, or plain CSS — it's all up to you!