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

@h-k-dev/angular-tooltips

v1.0.0

Published

A lightweight, signal-based Angular tooltip directive built on native popovers and CSS anchor positioning, with a single shared tooltip element and Interest Invokers support.

Downloads

426

Readme

@h-k-dev/angular-tooltips

npm version CI/CD license: MIT

[!WARNING] Experimental — Chrome only for now. This library is built on bleeding-edge platform features (CSS Anchor Positioning, position-visibility, anchored container queries, and Interest Invokers) that are currently only fully supported in Chrome and other Chromium-based browsers. Everywhere else the directive degrades to the native title attribute. Expect breaking changes while the underlying specs and this API settle.

Modern, lightweight tooltips for Angular. One singleton popover element, positioned entirely by CSS Anchor Positioning — no overlay module, no scroll listeners, no per-trigger DOM.

Live demo →

Why another tooltip library?

  • Singleton architecture — a single tooltip element is re-pointed between anchors instead of being destroyed and recreated. Sweep across a dense grid and the tooltip glides; the enter animation never restarts mid-sweep (the classic MatTooltip flicker).
  • Top layer, always — the tooltip is a native [popover], so it renders above dialogs and is never clipped by overflow or z-index stacking contexts.
  • CSS does the work — placement, auto-flipping at the viewport edge, tail direction, and hide-when-scrolled-out (position-visibility: anchors-visible) are all handled by the browser.
  • Browser-native triggering for links — on <a href> elements in supporting browsers, the Interest Invokers (interestfor) path is used: the browser owns hover, keyboard focus, touch long-press, and delays.
  • Works on any element<button>, <a>, <span>, <div>, <img>, <input>, icons, component hosts…
  • Graceful degradation — browsers without CSS Anchor Positioning fall back to the native title attribute.

Installation

npm install @h-k-dev/angular-tooltips

Usage

Import the standalone directive and attach it to anything:

import { Component } from '@angular/core';
import { HkTooltip } from '@h-k-dev/angular-tooltips';

@Component({
  selector: 'app-demo',
  imports: [HkTooltip],
  template: `
    <button [hkTooltip]="'Save your progress'">Save</button>

    <button hkTooltip="Deletes immediately" hkTooltipPlacement="right" [hkTooltipDelay]="300">
      Delete
    </button>

    <a href="/docs" hkTooltip="Opens the documentation">Docs</a>
  `,
})
export class Demo {}

API

[hkTooltip] directive

| Input | Type | Default | Description | | -------------------- | ---------------------------------------- | ------- | ----------------------------------------------- | | hkTooltip | string (required) | — | Tooltip text. | | hkTooltipPlacement | 'top' \| 'bottom' \| 'left' \| 'right' | 'top' | Preferred side; auto-flips when space runs out. | | hkTooltipDelay | number (ms) | 0 | Delay before showing. | | hkTooltipHideDelay | number (ms) | 80 | Delay before hiding. |

[hkTooltipRoot] directive

Optional. Scopes the event delegation to a subtree (for example a virtualized grid) instead of document.body.

Theming

The tooltip is styled through CSS custom properties with the --tt- prefix. Every variable falls back to the Angular Material tooltip tokens, then the --mat-sys-* system tokens, then a built-in default:

--tt-*  (your theme)  →  --mat-tooltip-*  →  --mat-sys-*  →  default

With an Angular Material theme present, the tooltip matches it out of the box. Without Material, the defaults give you the familiar dark M3 look. Override on :root (or any ancestor of <body>):

:root {
  --tt-container-color: #1e293b;
  --tt-text-color: #e2e8f0;
  --tt-border-radius: 8px;
  --tt-max-width: 320px;
}

| Variable | Purpose | Material fallback | Default | | --------------------- | ----------------------------- | ----------------------------------------------------------------------- | ------------------- | | --tt-container-color| Background of bubble and tail | --mat-tooltip-container-color--mat-sys-inverse-surface | #313033 | | --tt-text-color | Text color | --mat-tooltip-supporting-text-color--mat-sys-inverse-on-surface | #f4eff4 | | --tt-border-radius | Corner radius | --mat-tooltip-container-shape--mat-sys-corner-extra-small | 4px | | --tt-font-family | Font family | --mat-tooltip-supporting-text-font--mat-sys-body-small-font | Roboto, sans-serif| | --tt-font-size | Font size | --mat-tooltip-supporting-text-size--mat-sys-body-small-size | 12px | | --tt-font-weight | Font weight | --mat-tooltip-supporting-text-weight--mat-sys-body-small-weight | 400 | | --tt-line-height | Line height | --mat-tooltip-supporting-text-line-height--mat-sys-body-small-line-height | 1.4 | | --tt-letter-spacing | Letter spacing | --mat-tooltip-supporting-text-tracking--mat-sys-body-small-tracking | 0.033em | | --tt-shadow | Box shadow | — | none | | --tt-padding | Inner padding | — | 6px 10px | | --tt-max-width | Maximum width | — | 280px | | --tt-gap | Distance from the anchor | — | 8px | | --tt-tail-size | Tail (arrow) size | — | 6px | | --tt-enter-duration | Slide-in duration | — | 0.3s | | --tt-fade-duration | Fade-in duration | — | 0.15s | | --tt-slide-distance | Slide-in distance | — | 10px |

Keep --tt-tail-size smaller than --tt-gap, so the tail never overlaps the trigger.

Browser support

| Capability | Behaviour | | -------------------------------------------- | --------------------------------------------------------------- | | CSS Anchor Positioning | Full experience: singleton popover, auto-flip, scroll tracking. | | Interest Invokers (interestfor) | Additionally: browser-native triggering on <a href> links. | | Neither | Falls back to the native title attribute. |

Development

npm start                        # demo app on http://localhost:4200
npm run test:ci                  # headless vitest suite
npm run build angular-tooltips   # build the library into dist/

Releases are automated with semantic-release: conventional commits pushed to main (or beta for prereleases) publish to npm and GitHub Packages and deploy the demo to GitHub Pages.

License

MIT