npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@papit/tooltip

v0.0.12

Published

Hint bubble that appears next to a trigger on hover or focus, after a configurable delay. Connect it to any element with the popovertarget attribute.

Readme

@papit/tooltip

Hint bubble that appears next to a trigger on hover or focus, after a configurable delay. Connect it to any element with the popovertarget attribute.

Logo


Type Tests NPM version


Installation

npm install @papit/tooltip

Usage

Import

import "@papit/tooltip";

Basic example

The tooltip needs an id, and the trigger points at it with popovertarget. Both must be in the DOM when the tooltip connects.

<button popovertarget="save-tip">Save</button>
<pap-tooltip id="save-tip">Save your changes (Ctrl+S)</pap-tooltip>

Placement and marker

<button popovertarget="info-tip">Info</button>
<pap-tooltip id="info-tip" placement="right" marker>
  Tooltips can hold <strong>simple HTML</strong>
</pap-tooltip>

No delay

<pap-tooltip id="quick-tip" instant>Shown right away</pap-tooltip>
<pap-tooltip id="slow-tip" delay="300">Shown after 300 ms</pap-tooltip>

Opening a tooltip closes any other open pap-tooltip.


Attributes / Properties

Extends pap-popover (@papit/popover), so open, show(), hide() and toggle() work too.

| Attribute | Property | Type | Default | Description | | ----------- | ----------- | ----------- | ---------- | ------------------------------------------------------ | | placement | placement | Placement | "bottom" | Side of the trigger (see @papit/placement for values) | | delay | delay | number | 1000 | Milliseconds before the tooltip shows | | instant | instant | boolean | false | Skip the delay | | marker | marker | boolean | false | Show an arrow pointing at the trigger | | disabled | disabled | boolean | false | Never show; setting it hides an open tooltip | | open | open | boolean | false | Whether the tooltip is shown |


Events

| Event | Description | | -------- | --------------------------------------------------- | | toggle | Native popover ToggleEvent when it shows or hides |


Slots

| Slot | Description | | --------- | ------------------- | | (default) | The tooltip content |


Methods

| Method | Description | | --------------- | ------------------------------------------------------------------ | | show(trigger?) | Show after delay (or at once with instant), anchored to trigger | | hide() | Hide, and cancel a pending show |


Styling

| Part | Description | | ----------- | ------------------------------- | | container | The bubble around the content |

| Custom property | Default | Description | | --------------------- | ------- | ------------------------- | | --max-tooltip-width | 30rem | Maximum width of the bubble | | --bg | mix of --background-inverse and --shade-1 | Bubble and marker colour |

pap-tooltip {
  --bg: var(--primary);
  --max-tooltip-width: 16rem;
}

Keyboard Interaction

| Key | Behavior | | ----- | --------------------------------------------------------- | | Tab | Focusing the trigger shows the tooltip; leaving it hides it |


Accessibility

  • Shows on hover and on keyboard focus of the trigger.
  • The pointer can move onto the tooltip without it closing, so the content stays hoverable.

Known gaps against the pattern:

  • role="tooltip" and aria-describedby on the trigger aren't set for you. Add them yourself:

    <button popovertarget="save-tip" aria-describedby="save-tip">Save</button>
    <pap-tooltip id="save-tip" role="tooltip">Save your changes</pap-tooltip>
  • Escape doesn't dismiss the tooltip yet.

Reference: https://www.w3.org/WAI/ARIA/apg/patterns/tooltip/


License

Licensed under the @Papit License 1.0 Copyright (c) 2024 Henry Pap (@onkelhoy)

Key points

  • ✅ Free to use in commercial projects
  • ✅ Free to modify and distribute
  • ✅ Attribution required
  • ❌ Cannot resell the component itself as a standalone product

See the LICENSE file for full details.


Related Components