Skip to content

ionited/tooltip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tooltip

A simple and lightweight tooltip library

A library under 4KB to display informative texts as known as tooltips.

Quick start

Choose your favorite option below:

Install with NPM

npm i @ionited/tooltip

Get from UNPKG

https://unpkg.com/@ionited/tooltip@latest/dist/tooltip.js


Usage

To basic usage you can simply call:

Tooltip(document.querySelector('button')); // Defaults to get title attribute content

Options

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;
}

License

Copyright (c) 2021 Ion. Licensed under Mit License.

https://ionited.io

Releases

No releases published

Packages

No packages published