solid-notifications
v1.2.0
Published
A Solidjs toast notifications library
Downloads
356
Maintainers
Readme
Solid Notifications
A lightweight, customizable, and easy-to-use toast notification library for SolidJS applications.
Features
- 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.
- 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.
Getting Started
To get started with Solid Notifications, visit the official documentation website:
The documentation includes installation instructions, usage examples, API reference, and customization guides.
Installation
You can install Solid Notifications via npm:
npm install solid-notificationsPeer Dependencies
Solid Notifications requires solid-js as a peer dependency. Make sure you have it installed:
npm install solid-jsQuick Example
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.
Development
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-notificationsInstall dependencies: Next, install all the necessary dependencies to get things up and running:
npm installRun the playground: To test your changes or experiment with the library, start the development server:
npm run devThis 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
License
This project is licensed under the MIT License.
