https://github.com/ionited/tooltip
A simple and lightweight tooltip library
https://github.com/ionited/tooltip
informative text tooltip
Last synced: 3 months ago
JSON representation
A simple and lightweight tooltip library
- Host: GitHub
- URL: https://github.com/ionited/tooltip
- Owner: ionited
- License: mit
- Created: 2021-07-08T21:37:58.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2024-06-26T22:15:19.000Z (almost 2 years ago)
- Last Synced: 2025-04-07T21:09:24.553Z (about 1 year ago)
- Topics: informative, text, tooltip
- Language: TypeScript
- Homepage:
- Size: 64.5 KB
- Stars: 15
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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](https://unpkg.com/@ionited/tooltip@latest/dist/tooltip.js)
---
## Usage
To basic usage you can simply call:
```js
Tooltip(document.querySelector('button')); // Defaults to get title attribute content
```
### Options
```ts
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](LICENSE).
[https://ionited.io](https://ionited.io)