A SolidJS Toast Notifications Library
Lightweight, customizable, and easy-to-use toast notification library for SolidJS applications.
- Simple API: Easily create and manage toast notifications with just a few lines of code.
- Customizable: Fully customizable styles, positions, behaviors and much more.
- Lightweight: Minimal footprint with zero unnecessary dependencies (just 7kb gzipped).
- Multiple Toasters support: Seamlessly manage multiple independent toasters in your app for diverse notification needs, all within a single setup.
- TypeScript Support: Comes with built-in TypeScript types for a better developer experience.
To get started with Solid Notifications, visit the official documentation website:
π View Documentation
The documentation includes installation instructions, usage examples, API reference, and customization guides.
You can install Solid Notifications via npm:
npm install solid-notifications
Solid Notifications requires solid-js
as a peer dependency. Make sure you have it installed:
npm install solid-js
Here's a quick example to show how easy it is to use:
-
Mount the ToastProvider and Toaster components:
import { ToastProvider, Toaster } from "solid-notifications"; export default function App(props) { return ( <ToastProvider> <Toaster /> {props.children} </ToastProvider> ); }
-
Import the Solid Notifications css file into your main css file:
/* index.css */ @import "solid-notifications/index.css";
-
Create toasts:
import { useToast } from "solid-notifications"; export default function AppContent() { const { notify } = useToast(); return ( <div> <button onClick={() => notify("π New toast ready to serve!")}> Create a Toast! </button> </div> ); }
For more examples and advanced usage, check out the documentation.
If you'd like to contribute to Solid Notifications, follow these steps to set up the project locally:
-
Clone the repository: First, grab a copy of the project by cloning the repository:
git clone https://github.com/Nyloth9/solid-notifications.git cd solid-notifications
-
Install dependencies: Next, install all the necessary dependencies to get things up and running:
npm install
-
Run the playground: To test your changes or experiment with the library, start the development server:
npm run dev
This will launch the playground where you can see your changes in real-time.
-
Edit the website: To preview or test the documentation, navigate to the website folder and start the development server:
cd website npm install npm run dev
This project is licensed under the MIT License.