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

next-turbopack-ui-tagger

v0.1.2

Published

Add data-ui-id and data-ui-name attributes to JSX in Next.js Turbopack apps

Downloads

376

Readme

next-turbopack-ui-tagger

Adds data-ui-id and data-ui-name attributes to JSX elements in a Next.js app that uses Turbopack.

This makes it easier to inspect something in the browser and jump back to the matching source code.

What it adds

  • data-ui-id="src/components/ui/button.tsx:42:7"
  • data-ui-name="Button"

data-ui-id is the JSX usage location: file, line, and column.

data-ui-name is the exact JSX element token from source code.

Examples:

  • <div /> -> data-ui-name="div"
  • <TabsList /> -> data-ui-name="TabsList"
  • <SelectPrimitive.Trigger /> -> data-ui-name="SelectPrimitive.Trigger"

Install

npm i -D next-turbopack-ui-tagger

Next.js config

Use an environment flag so the tags are only added when you want them.

import type { NextConfig } from "next";

const enableUiMap = process.env.NEXT_PUBLIC_UI_TAGGER === "1";

const nextConfig: NextConfig = {
  turbopack: enableUiMap
    ? {
        rules: {
          "*.jsx": {
            loaders: ["next-turbopack-ui-tagger"],
          },
          "*.tsx": {
            loaders: ["next-turbopack-ui-tagger"],
          },
        },
      }
    : undefined,
};

export default nextConfig;

Run

NEXT_PUBLIC_UI_TAGGER=1 next dev

Many apps wrap this in a script:

{
  "scripts": {
    "dev:ui-map": "NEXT_PUBLIC_UI_TAGGER=1 next dev"
  }
}

How to use it

  1. Open your app with UI mapping enabled.
  2. Inspect an element in the browser.
  3. Copy data-ui-id.
  4. Paste it into VS Code or Cursor Quick Open.

Example:

src/components/ui/sliding-segmented-control.tsx:55:4

You can also open it from terminal:

code -g "src/components/ui/sliding-segmented-control.tsx:55:4"

How to read the result

  • If data-ui-name is lowercase, like div or button, you are usually looking at a native DOM JSX line.
  • If data-ui-name is PascalCase or dotted, like TabsList or SelectPrimitive.Trigger, you are looking at a component usage line.
  • In that case, open data-ui-id first, then use your editor's "Go to Definition" on the component name if you want the implementation.

Limitations

  • The loader only runs on .jsx and .tsx files.
  • Files inside node_modules are ignored.
  • For custom components, the attributes only appear in the final DOM if that component forwards data-* props down to a rendered element.

Notes

  • This package is meant for development workflows.
  • The loader transpiles the transformed file to JavaScript so Turbopack can continue parsing TSX inputs correctly.