poptip
v0.1.4
Published
An independent popup library
Downloads
2
Readme
poptip
An independent popup library
Installation
npm i poptip
Usage
import poptip from "poptip";
import "poptip/style.css";
poptip.info("This is a message!");
poptip.warn({ html: '<span class="red">hello</span>' });
const el = document.createElement("div");
poptip.error(el);
API
type RichContent =
| string
| HTMLElement
| {
html: string;
};
interface Config {
type: MsgType;
content: RichContent;
title?: RichContent;
live?: number;
}
// live: message box live time (millisecond). positive number means autoclose
type OtherConfig = Omit<Config, "type" | "content">;
declare const poptip: {
info: (content: RichContent, config?: OtherConfig) => void;
warn: (content: RichContent, config?: OtherConfig) => void;
error: (content: RichContent, config?: OtherConfig) => void;
};