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

@surstromming/tooltip

v0.1.2

Published

A short label on hover or focus.

Readme

@surstromming/tooltip

A short label that appears on hover or focus — the name of an icon button, a hint on a truncated value. Text only; anything richer is a Popover.

Dependency graph

graph LR
  tooltip["@surstromming/tooltip"]
  design["@surstromming/design"]
  util["@surstromming/util"]
  tooltip --> design
  tooltip --> util

Usage

<template>
  <Tooltip content="Add to library" side="bottom">
    <Button size="icon" aria-label="Add"><Icon :icon="Plus" /></Button>
  </Tooltip>
</template>

<script setup lang="ts">
import { Tooltip } from '@surstromming/tooltip'
import { Button } from '@surstromming/button'
import { Icon } from '@surstromming/icon'
import { Plus } from 'lucide'
</script>

Props

| Prop | Type | Default | Notes | | --------- | --------------------------------- | ------- | --------------------------------------- | | content | string | — (required) | The label text | | side | top \| right \| bottom \| left | top | Preferred edge — flips to the opposite one when there's no room | | delay | number | 300 | ms before it shows | | v-model:open | boolean | false | Optional — usually left to hover/focus |

Slots

| Slot | Description | | --------- | ---------------------------------------------------- | | default | The trigger. Keep it focusable so keyboard users get the tip too. |

Behavior

  • Shows after delay on mouseenter/focusin; hides immediately on leave, blur or Escape. A pointer passing through never flashes it; the pending timer is cancelled on the way out.
  • The tip is pointer-events: none, so it can't eat the hover it describes.
  • The tip teleports to <body> and is positioned fixed from the trigger's measured rect (useAnchoredTip), re-measured on scroll and resize. Left inside the trigger's own box it was clipped by any overflow ancestor — and every page here scrolls through a ScrollArea, so a trigger near the top of one had its whole tip cut away.
  • It flips rather than shifting: side is a preference, and when the tip won't fit there it moves to the opposite edge (only if that one fits — otherwise flipping would just move the problem). The cross axis is then clamped 8px inside the viewport. This is the opposite of Popover, which shifts and stays on the side it was asked for: a popover is a surface you work in, a tip is a label.

Tokens

primary / primary-foreground (the inverted chip shadcn uses), radius(md), 0.75rem type, z-index(tooltip) — the ladder's top rung, so it clears every overlay including a dialog's own controls.

Notes

  • The trigger must be focusable (a Button, a link) for the tip to be keyboard-reachable — a tooltip on a bare <span> is mouse-only.