npm package

Add FloatPrompt to a web project, so captures of its dev page get the elements, components and file:line. It needs the FloatPrompt Mac app installed and running; the setup guide covers that.

Add FloatPrompt to this project.
Follow https://floatprompt.com/npm

If they build a website or web app, the floatprompt package connects its dev page to FloatPrompt, so captures get the elements, React components and file:line in any browser, including ChatGPT's built-in browser. It runs only on local dev addresses (localhost, 127.0.0.1) and never in a production build. Ask whether they want it in their project.

  1. Find the project's framework (Next.js, Vite, other) and package manager.
  2. Install the beta as a dev dependency: npm install --save-dev floatprompt@beta (or pnpm add -D floatprompt@beta, yarn add -D floatprompt@beta, bun add -d floatprompt@beta). The @beta matters: plain floatprompt is still the older tool.
  3. Add one line:
    • Next.js (App Router): in the root layout (app/layout.tsx or src/app/layout.tsx), import { FloatPrompt } from "floatprompt/next"; and <FloatPrompt /> inside <body>.
    • Vite: in vite.config, import { floatprompt } from "floatprompt/vite"; and add floatprompt() to plugins.
    • Other React: <FloatPrompt /> from floatprompt/react at the app's root.
    • Anything else: import "floatprompt"; in the entry file.
  4. Start the dev server. A small chip in the page's corner says "Connected" when FloatPrompt is running.
  5. Run the project's build, then npx floatprompt check <build folder>: it must pass, which shows the client stayed out of the build.

No install, for a quick test or a plain HTML page: one line in the page's HTML gives the same elements, components and file:line, since they come from the framework's own dev build: <script src="http://127.0.0.1:47653/floatprompt.js"></script> (the FloatPrompt app serves it, always matching its version). It stays in that file, so take it out before the page goes live. In a real project the package is better, because it switches itself off in production builds.

The package's full guide is in node_modules/floatprompt/floatprompt.md.