A simple and lightweight tooltip library
A library under 4KB to display informative texts as known as tooltips.
Choose your favorite option below:
npm i @ionited/tooltip
https://unpkg.com/@ionited/tooltip@latest/dist/tooltip.js
To basic usage you can simply call:
Tooltip(document.querySelector('button')); // Defaults to get title attribute content
Tooltip(el: HTMLElement, options?: TooltipOptions): TooltipCore
interface TooltipOptions {
content?: string;
contentAttr: string = 'title';
showOnClick: boolean = false;
}
interface TooltipCore {
destroy(): void;
hide(): void;
show(): void;
update(): void;
}
Copyright (c) 2021 Ion. Licensed under Mit License.