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

@michal.cupak/react-idle-cursor-hide

v1.0.4

Published

Hide the mouse cursor in React after a period of inactivity.

Readme

react-idle-cursor-hide

Small React utility package that hides the mouse cursor after a period of inactivity.

It provides:

  • useIdleCursorHide() hook
  • IdleCursorBoundary wrapper component

Useful for kiosk apps, signage players, fullscreen dashboards, media viewers, and touch-first interfaces.

Installation

npm i @michal.cupak/react-idle-cursor-hide

Required CSS

Import the packaged CSS once in your app:

import "@michal.cupak/react-idle-cursor-hide/styles.css";

Quick start

Apply to the entire page

import { useIdleCursorHide } from "@michal.cupak/react-idle-cursor-hide";
import "@michal.cupak/react-idle-cursor-hide/styles.css";

export default function App() {
  useIdleCursorHide({
    idleMs: 2000,
    target: "body",
  });

  return <main>My app</main>;
}

Apply only inside a container

import { IdleCursorBoundary } from "@michal.cupak/react-idle-cursor-hide";
import "@michal.cupak/react-idle-cursor-hide/styles.css";

export default function App() {
  return (
    <IdleCursorBoundary idleMs={1500} wrapperStyle={{ minHeight: "100vh" }}>
      <main>My app</main>
    </IdleCursorBoundary>
  );
}

API

useIdleCursorHide(options)

Returns a boolean hidden state.

Options

  • idleMs?: number — inactivity timeout in milliseconds, default 2000
  • disabled?: boolean — disable behavior, default false
  • initiallyHidden?: boolean — start hidden, default false
  • className?: string — class applied when hidden, default idle-cursor-hidden
  • target?: "body" | "element" — where to apply the class, default body
  • element?: HTMLElement | null — target element when target: "element"
  • events?: Array<keyof WindowEventMap> — events that reset inactivity timer

IdleCursorBoundary

Props are the same as the hook options except element, plus:

  • wrapperClassName?: string
  • wrapperStyle?: React.CSSProperties

By default, the component wraps children in a div and hides the cursor on that container.

Advanced example

import { useRef } from "react";
import { useIdleCursorHide } from "@michal.cupak/react-idle-cursor-hide";
import "@michal.cupak/react-idle-cursor-hide/styles.css";

export default function Player() {
  const ref = useRef<HTMLDivElement>(null);

  const hidden = useIdleCursorHide({
    idleMs: 3000,
    target: "element",
    element: ref.current,
    events: ["mousemove", "mousedown", "touchstart", "keydown"],
  });

  return (
    <div ref={ref} style={{ minHeight: "100vh" }}>
      Cursor hidden: {String(hidden)}
    </div>
  );
}

Build

npm install
npm run build

Output goes to dist/.

Notes

  • The package is SSR-safe because DOM access happens inside useEffect.
  • This hides the cursor via CSS inside the browser window. It does not control the operating system cursor outside the browser.
  • For Raspberry Pi kiosk deployments, browser-level hiding is often enough, but compositor-level cursor suppression can still be more robust.

License

MIT