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

@zacrify/react-design-inspector

v0.1.1

Published

Developer-only React design inspector — hover any element to see its component, box model, and computed styles, and walk the DOM/component tree by keyboard.

Readme

React Design Inspector

Developer-only visual inspection for React apps.

React Design Inspector lets code-first product teams inspect the running browser surface instead of measuring static screens. Drop one component into your app, toggle inspection mode, and hover any rendered element to see its size, position, computed styles, class names, and best-effort React component ownership.

Code is the source of truth. The browser is the design surface.

Install

npm install @zacrify/react-design-inspector

React and React DOM are peer dependencies:

npm install react react-dom

Usage

Render the inspector once near the root of your app. It does not require changes to your existing application components.

import { DesignInspector } from '@zacrify/react-design-inspector';

export function Root() {
  return (
    <>
      <App />

      {import.meta.env.DEV && <DesignInspector />}
    </>
  );
}

For non-Vite apps, use whatever development flag your framework provides:

{process.env.NODE_ENV === 'development' && <DesignInspector />}

Toggle

Press:

  • Cmd+Shift+D on macOS
  • Ctrl+Shift+D on Windows/Linux

When disabled, the component returns null and does not track pointer movement.

What You See

Hover any element while the inspector is enabled to show:

  • HTML tag name
  • width and height
  • x and y viewport position
  • padding
  • border width
  • margin
  • background color
  • text color
  • font size
  • font weight
  • border radius
  • detected utility class names, including common Tailwind classes
  • best-effort React component root names

Measurements come from:

element.getBoundingClientRect();

Computed styles come from:

getComputedStyle(element);

Keyboard Navigation

After hovering an element, use arrow keys to walk nearby DOM nodes:

  • ArrowUp: parent element
  • ArrowDown: first child element
  • ArrowLeft: previous sibling
  • ArrowRight: next sibling
  • Shift+ArrowUp: nearest ancestor React component root
  • Shift+ArrowDown: nearest descendant React component root

The overlay shows compact labels for available parent, child, previous, and next targets.

Tailwind Awareness

The inspector does not parse Tailwind configuration yet. It simply detects and displays class names with common utility prefixes, such as:

p-6
gap-4
rounded-2xl
text-base
bg-white
font-bold

This keeps the first version lightweight while still making utility-heavy UIs easier to inspect.

React Component Detection

React component detection is best effort. The package reads React Fiber metadata attached to DOM nodes by React, which is not a public React API.

That means component names may be unavailable or imperfect in some builds, frameworks, React versions, or minified production bundles. The inspector is defensive: if component detection fails, DOM measurement still works.

Overlay Behavior

The overlay is designed not to interfere with your application:

  • fixed positioning
  • pointer-events: none
  • high z-index
  • inline styles
  • no required CSS import
  • dark translucent tooltip
  • small monospace text

Because the overlay is non-interactive, it should not steal clicks, hovers, focus, or pointer events from the app being inspected.

Performance

React Design Inspector keeps updates lightweight:

  • pointer tracking only runs while enabled
  • pointer movement is throttled with requestAnimationFrame
  • measurements are read directly from the DOM
  • the application component tree is not re-rendered
  • only the inspector overlay updates

Storybook

The package is Storybook-compatible because it is just a React component. Add it to a preview decorator in development:

import type { Preview } from '@storybook/react';
import { DesignInspector } from '@zacrify/react-design-inspector';

const preview: Preview = {
  decorators: [
    (Story) => (
      <>
        <Story />
        <DesignInspector />
      </>
    ),
  ],
};

export default preview;

Local Development

Build once:

npm run build

Build continuously while using npm link or a local file dependency:

npm run dev

The package serves compiled files from dist, so source edits must be rebuilt before consuming apps see them.

API

import { DesignInspector, getComponentName } from '@zacrify/react-design-inspector';

DesignInspector

<DesignInspector />

Adds the developer-only inspection overlay.

getComponentName(element)

const name = getComponentName(element);

Returns the nearest detected React component name for a DOM element, or null if no component name can be resolved.

Current Scope

Implemented:

  • hover inspection
  • bounding box highlight
  • measurement tooltip
  • computed style display
  • utility class display
  • best-effort component root display
  • keyboard navigation through DOM and component roots

Not implemented yet:

  • source file mapping
  • design token mapping
  • open source file action
  • open Storybook story action
  • Figma reference linking
  • screenshot export
  • JSON export
  • accessibility inspection

License

MIT