Getting Started
Toastice
is a small 8.4kB gzipped library that makes adding toasts to your project, easy and simple. It is written in typescript
so it is fully typed.
Featuresβ
- Simple and easy to start using β¨
- Can choose between different themes π
- Several in & out animations ποΈ
- Multiple severity (color) levels π
- Automatically or manually dismissible π
- Ability to pause countdown on hover β±οΈ
- Countdown automatically pauses when browser tab is inactive βΈοΈ
- Can hook into the toasts lifecycle with the
onOpen
andonClose
callbacks βοΈ - Limit the number of displayed toasts β
- Queueable toasts minimize a cluttered interface β»οΈ
- Countdown is visible through a progressbar π
- Update toasts on the fly π
- Big choice of visual customization options π
- Control stacking order (top or bottom) π€
- Prevent duplicate toasts β
... and much more!
Installationβ
Toastice
is available as an npm package.
To install, just run the command below
npm:
npm install toastice@latest
yarn:
yarn add toastice@latest
ToasticeContainerβ
After successfully completing the step above, import the ToasticeContainer
component and the toast
function into your index
file, do not forget to import the css
file:
import { ToasticeContainer, toast } from "toastice";
import "toastice/toastice.css";
const App = () => {
const showToastice = () => {
toast("Hello World");
};
return (
<>
<button onClick={showToastice}>Show Toastice</button>
<ToasticeContainer />
</>
);
};
info
The ToasticeContainer
acts as a hub to generate toasts on the screen, it should be rendered once in your application, preferably at the root of your app.
License
Licensed under MIT