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

@polarityio/pi-tooltip

v1.0.6

Published

Tooltip component with Floating UI positioning, configurable triggers, delays, and arrow

Readme

Polarity Integration Component Library

Tooltip Component

A tooltip overlay positioned with Floating UI that supports configurable placement, multiple trigger modes, delays, and an optional arrow.

Installation

npm install @polarityio/pi-tooltip

Peer Dependencies

Usage

import '@polarityio/pi-tooltip';

Basic Tooltip (hover + focus)

<button>
  Hover me
  <pi-tooltip>This is a tooltip</pi-tooltip>
</button>

Custom Placement

<button>
  Right tooltip
  <pi-tooltip placement="right">Appears on the right</pi-tooltip>
</button>

Click Trigger

<button>
  Click me
  <pi-tooltip trigger="click">Shown on click</pi-tooltip>
</button>

With Delay and No Arrow

html`
  <button>
    Delayed tooltip
    <pi-tooltip open-delay="500" close-delay="200" ?arrow=${false}> Appears after 500ms </pi-tooltip>
  </button>
`;

Targeting an External Element

<span id="my-target">Hover this text</span>
<pi-tooltip for="my-target" placement="bottom"> Tooltip for the span above </pi-tooltip>

API Reference

Properties

| Property | Type | Default | Description | | ------------ | --------------------- | --------------- | ----------------------------------------------------------------------------------------- | | placement | Placement | 'top' | Where the tooltip appears relative to the target. Reflected to attribute. | | open | boolean | false | Forces the tooltip to be visible. Reflected to attribute. | | disabled | boolean | false | Disables the tooltip. Reflected to attribute. | | delay | number | 0 | Default delay in milliseconds for both opening and closing. | | openDelay | number \| undefined | undefined | Delay before opening in milliseconds. Overrides delay. Set via open-delay attribute. | | closeDelay | number \| undefined | undefined | Delay before closing in milliseconds. Overrides delay. Set via close-delay attribute. | | offset | number | 8 | Distance in pixels between the tooltip and its target. | | arrow | boolean | true | Whether to show an arrow pointing to the target. Reflected to attribute. | | maxWidth | string | '300px' | Maximum width of the tooltip. Set via max-width attribute. | | trigger | string | 'hover focus' | Space-separated trigger types. Reflected to attribute. | | htmlFor | string \| undefined | undefined | ID of an external element to attach the tooltip to. Set via for attribute. |

Placement Values

'top' · 'top-start' · 'top-end' · 'right' · 'right-start' · 'right-end' · 'bottom' · 'bottom-start' · 'bottom-end' · 'left' · 'left-start' · 'left-end'

Trigger Values

| Trigger | Events Used | Description | | ------- | ------------------------------- | ----------------------- | | hover | pointerenter / pointerleave | Show on mouse hover. | | focus | focusin / focusout | Show on keyboard focus. | | click | click | Toggle on click. |

Combine triggers with spaces, e.g. trigger="hover focus".

Events

| Event Name | Detail | Description | | ------------------- | ------------------- | ------------------------------------------------------------------- | | pi-tooltip-change | { open: boolean } | Fired when the tooltip is shown or hidden. Bubbles and is composed. |

Slots

| Slot Name | Description | | ----------- | -------------------------------------- | | (default) | Tooltip content. Accepts text or HTML. |

CSS Custom Properties

| Property | Default | Description | | ------------------------- | --------------------------------------------------- | ------------------------- | | --pi-tooltip-background | var(--pi-color-background-application-4, #2c3240) | Tooltip background color. | | --pi-tooltip-color | var(--pi-color-font-primary, #fafaff) | Tooltip text color. |

Positioning

The tooltip uses @floating-ui/dom for positioning with the following middleware:

  • offset — Applies the offset property as spacing from the target.
  • flip — Automatically flips placement if the tooltip would overflow the viewport.
  • shift — Shifts the tooltip along the axis to stay within the viewport (5px padding).
  • arrow — Positions the arrow element when arrow is enabled.

The tooltip is rendered as a fixed-position element appended to document.body.

Accessibility

  • Sets aria-describedby on the target element referencing the tooltip.
  • Adds tabindex="0" to non-focusable target elements.
  • The popup element has role="tooltip".
  • Pressing Escape closes the tooltip.

Theming

Customize the appearance using CSS custom properties. This component uses design tokens from @polarityio/pi-shared for consistent theming across the component library.

License

MIT