π Overview
Toast is a lightweight and highly customizable notification system for web applications. It allows you to display toast messages with ease, making it an excellent choice for improving user experience in modern web apps. Built using TypeScript, Tailwind CSS, and optimized with Vite, it provides a smooth and seamless integration.
π― Key Features
π¦ Installation
Clone the repository and install dependencies:
git clone https://github.com/sivaram-codfolio/toast.git
cd toast
npm install
π οΈ Usage
To use the Toast notification system in your React application, follow these steps:
import { useToast } from "@app/hooks";
const ToastComponent = () => {
const showToast = useToast();
const successToast = () => {
showToast("β
Success! Your changes have been saved.", { variant: "success", duration: 3000 });
};
const errorToast = () => {
showToast("β Error! Something went wrong.", { variant: "error" });
};
return (
<>
<button onClick={successToast}>Show Success Toast</button>
<button onClick={errorToast}>Show Error Toast</button>
</>
);
};
ποΈ Customization
You can customize the toastβs appearance and behavior by modifying the toast.tsx file. Tailwind CSS classes can be updated directly in the component, or you can override them in a custom CSS file for more flexibility.
Hereβs an example for custom configurations:
const customToast = (message: string) => {
showToast(message, { variant: "info", duration: 5000 });
};
π€ Contributing
We welcome contributions to improve the Toast Notification System. Feel free to fork the repository, report bugs, or submit pull requests.
π License
This project is licensed under the MIT License. See the LICENSE file for more information.