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

@mshafiqyajid/react-tooltip

v0.4.0

Published

Headless tooltip hook and styled component for React. Accessible, keyboard-friendly, smart flip positioning, animated, SSR-safe, fully typed.

Readme

@mshafiqyajid/react-tooltip

Headless tooltip hook and styled component for React. Accessible, keyboard-friendly, smart flip positioning, animated, SSR-safe, fully typed.

Full docs →

Zero dependencies. SSR-safe. Fully typed. ESM + CJS.

Install

npm install @mshafiqyajid/react-tooltip

Peer dependency: react >= 17.

Quick start

Styled (recommended)

import { TooltipStyled } from "@mshafiqyajid/react-tooltip/styled";
import "@mshafiqyajid/react-tooltip/styles.css";

<TooltipStyled content="Copy to clipboard">
  <button>Copy</button>
</TooltipStyled>

Headless

import { useTooltip } from "@mshafiqyajid/react-tooltip";

function MyTooltip({ content, children }) {
  const { triggerProps, tooltipProps, placement, isVisible } = useTooltip({ placement: "top" });

  return (
    <div style={{ position: "relative", display: "inline-flex" }}>
      <div {...triggerProps}>{children}</div>
      <div
        {...tooltipProps}
        data-placement={placement}
        style={{ opacity: isVisible ? 1 : 0 }}
      >
        {content}
      </div>
    </div>
  );
}

Props

| Prop | Type | Default | Description | |---|---|---|---| | content | ReactNode | — | Tooltip text or content | | placement | top \| bottom \| left \| right plus each with -start / -end | "top" | Preferred side and alignment | | size | "sm" \| "md" \| "lg" | "md" | Size of the tooltip | | tone | "neutral" \| "primary" \| "success" \| "danger" | "neutral" | Color tone | | delay | number | 0 | Show delay in ms | | multiline | boolean | false | Allow content to wrap (for rich HTML content) | | disabled | boolean | false | Disable the tooltip | | offset | number | 8 | Gap in px between trigger and tooltip | | collisionPadding | number | 8 | Viewport edge margin for flip / shift | | flip | boolean | true | Auto-flip to opposite side near edges | | shift | boolean | true | Push back into view along the cross-axis | | strategy | "absolute" \| "fixed" | "absolute" | Positioning strategy | | interactive | boolean | false | Stay open when cursor moves onto tooltip body (50ms bridge delay) | | followCursor | boolean | false | Tooltip tracks pointer position instead of anchoring to trigger | | sticky | boolean | false | Keep open while cursor is over the tooltip body | | header | ReactNode | — | Optional header above content | | footer | ReactNode | — | Optional footer below content | | longPressDelay | number | 500 | Touch long-press delay in ms; 0 disables touch trigger | | group | string | — | Group key for keyboard nav between tooltips | | groupId | string | — | Order id within the group (falls back to DOM order) |

data-placement on the tooltip reflects the resolved (post-flip) placement.

TooltipProvider props

| Prop | Type | Default | Description | |---|---|---|---| | delayIn | number | 700 | Show delay for the first tooltip in the group | | skipDelay | number | 50 | Show delay for subsequent tooltips while group is active (sweep) | | delayOut | number | 200 | How long after all tooltips close before the group resets |

License

MIT

What's new in 0.4.0

  • <TooltipProvider delayIn={700} skipDelay={50} delayOut={200}> — wrap multiple tooltips in a delay group. First tooltip opens after delayIn; while any in the group is open, subsequent ones open after skipDelay (sweep behaviour). After all close, the timer resets after delayOut ms. CSS class rtt-provider.
  • interactive?: boolean — keeps the tooltip open when the cursor moves from the trigger onto the tooltip body. A 50ms bridge prevents accidental dismissal when crossing the gap. The tooltip gets pointer-events: auto and data-interactive.
  • followCursor?: boolean — tooltip tracks the pointer instead of anchoring to the trigger. Flip/shift are disabled. Useful for data-viz hover labels. The arrow is hidden and data-follow-cursor is set.
  • <TooltipObserver /> — mount once; auto-wraps any element with data-tooltip="…" in a <TooltipStyled> using a MutationObserver.
  • Spring entrance animation — tooltip scales from 0.85 → 1 with cubic-bezier(0.34, 1.56, 0.64, 1) over 180ms; exit fades and scales back over 120ms. Transform origin tracks the placement side. Respects prefers-reduced-motion.

What's new in 0.3.0

  • sticky: true — keeps the tooltip open when the cursor moves from the trigger onto the tooltip body (interactive content).
  • --rtt-arrow-bg CSS var — themed tooltips now keep arrow colour in sync.
  • group?: string + groupId?: string — sequential keyboard nav; ↓/↑ on a focused trigger cycles through every tooltip sharing the group.
  • header? / footer? slots — render rich content above/below the main tooltip body without composing a popover.
  • longPressDelay?: number (default 500) — touch long-press to show; set 0 to disable touch trigger entirely.