@wtto00/toast
v0.1.2
Published
A simple toast notification library for the browser.
Readme
Toast for browser
Install
pnpm add @wtto00/toastUsage
import { showLoading, showToast, clearAll } from "@wtto00/toast";
const toast = showToast("Hello World!");
// close toast
toast.hide();
// get isHided of toast
console.log(toast.isHided);
const loading = showLoading("Loading...");
// close loading
loading.hide();
// set text of loading
loading.setText("uploading...");
// close all instances of loading
clearAll();Options
| Name | Type | Default | Description | | --------- | ------------------------------------------------------------------------------------------- | ---------------------------------------- | ------------------------------ | | position | 'top'|'center'|'bottom' | 'bottom' for toast, 'center' for loading | Location of toast | | theme | 'light'|'dark' | dark | Theme of toast | | timeout | number | 3s for toast, 0s for loading | The time of automatic shutdown | | allowHtml | boolean | false | Whether msg uses HTML strings | | style | CSSStyleDeclaration | undefined | style of content |
