# tooltipper

> A lightweight JavaScript library for implementing tooltips.

Latest version **1.1.6** (published 2023-03-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install tooltipper
pnpm add tooltipper
yarn add tooltipper
bun add tooltipper
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.6 |
| Published | 2023-03-28 |
| First published | 2020-06-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 16.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Kyle Andrews |
| Maintainers | codewithkyle |

## Links

- npm: https://www.npmjs.com/package/tooltipper
- npm.io page: https://npm.io/package/tooltipper

## Recent versions

- 1.1.6 (latest) — 2023-03-28
- 1.1.5 — 2022-12-14
- 1.1.4 — 2022-02-09
- 1.1.3 — 2021-12-31
- 1.1.2 — 2021-12-12
- 1.1.1 — 2021-12-11
- 1.1.0 — 2021-12-11
- 1.0.1 — 2021-10-17
- 1.0.0 — 2021-07-04
- 0.1.3 — 2020-06-22
- 0.1.2 — 2020-06-22
- 0.1.1 — 2020-06-22
- 0.1.0 — 2020-06-17

## README

# Tooltipper

A lightweight (1kB) JavaScript library for implementing tooltips.

## Installation

Install via NPM:

```sh
npm i -S tooltipper
```

Install via CDN:

```html
<script type="module" src="https://unpkg.com/tooltipper@1/tooltipper.min.mjs"></script>
<script defer src="https://unpkg.com/tooltipper@1/tooltipper.min.js"></script>
```

## Usage

Create tooltips using the `tooltip` attribute:

```html
<a href="#" tooltip="Edit file">
    <svg />
</a>
```

Create tooltips by adding the `tooltip` attribute to an element with an `aria-label` attribute:

```html
<a href="#" aria-label="Edit file" tooltip>
    <svg />
</a>
```

> **Please note** that tooltipper is an unopinionated library. All we aim to do is create, track, and remove custom `<tool-tip>` elements within the DOM. You are responsible for providing the CSS.

## Example SCSS

[Click here](https://codewithkyle.github.io/tooltipper/) to view the example.

```scss
tool-tip {
    background-color: #424242;
    color: #fff;
    border-radius: 0.125rem;
    line-height: 24px;
    height: 24px;
    white-space: nowrap;
    padding: 0 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    pointer-events: none;
    transform-origin: center;

    /* The visible class is applied once the tool-tip element as been appended to the body & positioned correctly */
    &.visible {
        animation: limitedTooltip 1725ms 150ms linear forwards;
    }
}
@keyframes limitedTooltip {
    0% {
        opacity: 1;
    }
    4% {
        opacity: 1;
    }
    96% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        animation-timing-function: ease-in-out;
    }
}
```

---
_Source: https://npm.io/package/tooltipper · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
