1.0.4 • Published 2 years ago
tooltip-helper v1.0.4
Tooltip Helper
A JavaScript package for adding a tooltip to any HTML element.
Installation
You can install the package using npm by running the following command.
npm install tooltip-helperUsage
You can initialise the tooltip-helper by importing and running the init function.
import { initTooltip } from "tooltip-helper";
initTooltip();Add the class hoverable to all the html elements on which you would like to have a tooltip. The tooltip content is defined by the data-attribute tooltip-title.
<button
class="hoverable"
data-tooltip-title="This is a button">
Sample Button
</button>Customisation
The tooltip can have either a light or a dark theme. You can pass in the theme as an argument when initialising the tooltip helper.
import { initTooltip } from "tooltip-helper";
initTooltip("dark");License
This project is licensed under the MIT License.