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

ink-use-mouse

v1.0.0

Published

Mouse support for Ink — click, hover, scroll, and drag in terminal UIs

Readme

ink-use-mouse

The mouse support Ink never built.

Click, hover, scroll, and drag in your terminal UI. Works with Ink 4+.

Install

npm install ink-use-mouse

Quick start

import { useMouse } from 'ink-use-mouse';

function App() {
  const mouse = useMouse();
  return <Text>Mouse at ({mouse.x}, {mouse.y}) {mouse.isPressed ? 'CLICK' : ''}</Text>;
}

API

useMouse() — raw mouse events

Returns the latest mouse state, updated on every move, click, and scroll.

const mouse = useMouse();
// mouse.x        — column (0-based)
// mouse.y        — row (0-based)
// mouse.button   — 'left' | 'middle' | 'right' | 'none'
// mouse.type     — 'press' | 'release' | 'move' | 'scroll-up' | 'scroll-down'
// mouse.isPressed — true if a button is held
// mouse.isActive  — true if mouse tracking is enabled

useMouseZone(ref) — hit testing

Detects if mouse events land inside a component's bounds.

function Button({ label, onPress }) {
  const ref = useRef(null);
  const { isHovered, isClicked } = useMouseZone(ref, { onClick: onPress });
  return (
    <Box ref={ref}>
      <Text color={isHovered ? '#F5D76E' : 'white'}>{label}</Text>
    </Box>
  );
}

<Clickable> — high-level click handler

<Clickable onClick={() => doSomething()}>
  <Text>Click me</Text>
</Clickable>

<Hoverable> — hover-aware rendering

<Hoverable>
  {(hovered) => <Text color={hovered ? 'yellow' : 'white'}>Item</Text>}
</Hoverable>

Terminal compatibility

| Terminal | Status | |----------|--------| | iTerm2 | Full support | | macOS Terminal | Full support | | Ghostty | Full support | | VS Code terminal | Full support | | tmux | Requires set -g mouse on in .tmux.conf | | Windows Terminal | Full support | | Alacritty | Full support |

SGR extended mode (\x1b[?1006h) is supported by all modern terminals. Legacy X10/Normal mode terminals (rare) are not supported.

How it works

  1. On mount, enables SGR mouse reporting via \x1b[?1003h\x1b[?1006h
  2. Parses stdin for SGR mouse escape sequences (\x1b[<Cb;Cx;CyM)
  3. On unmount, disables reporting via \x1b[?1003l\x1b[?1006l

The parser handles all SGR events: press, release, motion, scroll, and button identification.

Low-level parser

If you need to parse mouse events outside of React:

import { parseMouseEvents } from 'ink-use-mouse';

const events = parseMouseEvents(rawStdinData);
// [{ x: 10, y: 5, button: 'left', type: 'press', isPressed: true }]

Part of the Exe ecosystem

Built for the Exe OS terminal UI. Works standalone with any Ink app.

License

MIT