Skip to content

AI Editor

Five ways to reach a model without the cursor leaving the sentence — slash menu, inline completion, selection toolbar, action menu, property inspector — and the two surfaces that say where the answer came from.

7 blocks64 lineslucide-reactAdded 10 Sept 2026

What's included

  • app/ai-editor-page.tsx
  • 7 blocks it is built from, installed with it
  • Needs lucide-react

Works with

  • React
  • Next.js
  • Tailwind CSS
  • TypeScript

npx hoverlab add ai-editor-page

Or over MCP, from your editor's agent — no account needed.

License

Free to read, copy and install, for personal and non-commercial projects. Shipping it in client work or a paid product needs Pro ($79 once). The source lands in your repo and stops being ours — no attribution, nothing to upgrade.

Was this useful?

Preview

Editor

Five ways to reach the model without leaving the sentence you were writing — and the two surfaces that say where its answer came from.

Release notes — draft

Type / for actions

Rewritethis paragraph
Summarisethe whole document
Continue writingfrom the caret
Translatethis paragraph into French
Turn into a tablethe list above
Draft a briefa new section below

Escape removes the slash and anything typed after it — it does not leave you to clean up.

Keep typing — completions appear after a short pause.

The renewal conversation should start ninety days out, not thirty. By the time a customer is thirty days from renewal they have already formed a view, and the only lever left is discount. Teams that open the conversation at ninety days spend it on scope instead of price, and close at a materially higher rate — the difference in our own book was eleven points last year.

Select any text above to raise the toolbar. Shift-Arrow works too.

Do something with the selection

Every row says where the result lands. An AI action that silently replaces the paragraph someone spent ten minutes on is the fastest way to have the feature turned off.

Seasonal

Burnt honey & sea salt

Slow-churned with wildflower honey, finished with flaked salt.

Flavour card

Corner radiusset by agent
12px
Padding
20px
Accentset by agent
Title weight
Shadowset by agent

Agent adjusted 3 properties.

Grounding

Every claim points at something

The interesting half of a retrieval system is not what it does when it finds the answer. It is what it does when it does not.

  • Citations on the sentenceNot a source list at the bottom. The claim and its evidence are next to each other or the citation is decoration.
  • Quoted, not paraphrasedThe retrieved passage is shown as written, so you can see whether it says what the answer claims.
  • It says when it does not knowNo passage above the relevance floor produces "I could not find this", not a fluent guess.
  • Stale sources are flaggedAge travels with the passage. A confident answer from a two-year-old document is the failure nobody catches.

Oversight

Where the person actually is

"A human is in the loop" is a claim with no shape. These are the four points where one really is, and each is a thing the system will not do without them.

  • Before anything leavesExternal messages and payments stop and wait. The full payload is shown, not a summary of it.
  • On low confidenceThe run pauses rather than picking the best of four bad options and presenting it as an answer.
  • After the fact, in the logEvery unattended action is recorded with its inputs, and the log is exportable.
  • The stop buttonOne press halts a run mid-step and rolls back anything reversible. It is always on screen.

The real page, rendered in your current theme — every section below is a live block, not a screenshot.

Built from

All blocks
  1. Editor Slash MenuThe "/" menu inside a document: focus never leaves the editor, every row names what it acts on, and Escape cleans up the trigger text it inserted instead of leaving you to backspace it.
  2. Ghost Text CompletionCopilot-style completion in a plain textarea: a transparent-caret field over a metric-matched mirror, Tab to accept, Escape that actually sticks, and the suggestion announced rather than left as invisible grey text.
  3. Selection Action ToolbarHighlight a passage and hand it to the model. Positioned from the range rect relative to its container, raised by selectionchange so Shift-Arrow works, and every button prevents the mousedown that would collapse the selection.
  4. Inline AI Action MenuThe actions offered on a selection, each saying whether it rewrites in place or opens a draft beside it.
  5. Agent-Adjusted InspectorThe model edits real properties and every change is attributed and reversible — per-property provenance in words, per-property revert, and sliders whose aria-valuetext carries the unit.
  6. Grounding SplitHow an answer is tied to its sources, and what the system does when it cannot find any.
  7. Human Oversight SplitWhere a person sits in an automated run, written as four guarantees rather than as a promise that a human is involved.

Only want one section? Open it and copy that block instead — browse Inline AI Actions.

Source

app/ai-editor-page.tsx
/**
 * AI inside a document, rather than beside one.
 *
 * The chat window is the easy shape and the wrong one for editing. Every
 * surface on this page shares a single constraint that a chat panel does
 * not have: the user is in the middle of writing something, and the model
 * has to arrive without taking the cursor, the selection or the scroll
 * position away from them.
 *
 * That constraint is why the order runs from least to most interruptive.
 *
 *   slash menu       invoked by typing, so focus never leaves the editor
 *   inline           a completion in the text itself, dismissed by typing
 *   selection        a toolbar that only exists while a selection does
 *   action menu      an explicit, deliberate list of transformations
 *   inspector        the model edits real properties, each one attributed
 *                    and reversible
 *
 * <GroundingSplit> and <HumanOversightSplit> close the page and they are a
 * different kind of thing: not editing surfaces but the two answers to
 * "where did that come from" and "who is accountable for it". They belong
 * on this page rather than on the retrieval console because the person who
 * needs them is the one about to publish the paragraph, not the one
 * debugging the index.
 *
 * The inspector is the most interruptive and sits last among the editing
 * surfaces for a reason worth stating: per-property provenance is what
 * makes a bulk AI edit reversible, and reversibility is the thing that lets
 * someone accept a suggestion without reading all of it first.
 */

import * as React from 'react'
import { AiSlashMenu } from '@/components/ai-slash-menu'
import { AiInlineSuggestion } from '@/components/ai-inline-suggestion'
import { SelectionAiToolbar } from '@/components/selection-ai-toolbar'
import { AiActionMenu } from '@/components/ai-action-menu'
import { AiInspectorPanel } from '@/components/ai-inspector-panel'
import { GroundingSplit } from '@/components/grounding-split'
import { HumanOversightSplit } from '@/components/human-oversight-split'

export default function AiEditorPage() {
  return (
    <main className="min-h-screen bg-background text-foreground">
      <section className="mx-auto w-full max-w-5xl px-6 pb-2 pt-12">
        <h1 className="text-2xl font-bold tracking-tight">Editor</h1>
        <p className="mt-1 text-sm text-muted-foreground">
          Five ways to reach the model without leaving the sentence you were
          writing — and the two surfaces that say where its answer came from.
        </p>
      </section>

      <AiSlashMenu />
      <AiInlineSuggestion />
      <SelectionAiToolbar />
      <AiActionMenu />
      <AiInspectorPanel />

      {/* Provenance and accountability, for the person about to publish. */}
      <GroundingSplit />
      <HumanOversightSplit />
    </main>
  )
}

How to use it

  1. 1. Copy each of the 7 blocks above into components/ — each block page has its own copy button.
  2. 2. Drop this file at app/ai-editor-page.tsx. The imports already point at @/components/…, so they resolve with no edits.
  3. 3. Delete the sections you do not want. Every block takes props, so the copy changes without the layout moving.

For AI

The component, its props, the design tokens it expects and the command that installs it — as one prompt. Paste it into Claude, Cursor, v0 or ChatGPT and what they build around it will match the rest of the catalog instead of inventing its own system.

See the prompt

More App Screens

Open the full page for this page

Dashboard Overview

The screen an app opens on: shell, header, KPI row, chart and activity feed — numbers first, shape second, changes last.

App Screens5 blocks47 lines
Open the full page for this page

AI Assistant Screen

An agent working inside a real app: a transcript down the middle — reasoning, answer, then the one card that can act — with what it may read and what it noticed demoted to a rail.

App Screens7 blocks110 lines
Open the full page for this page

Project Board

A kanban board inside the app shell, with tabs that admit the board is one view among several and a header whose primary action is creating work.

App Screens3 blocks42 lines
Open the full page for this page

Customer List Screen

The canonical CRUD list — header, toolbar, sortable table and pagination framed as one panel instead of three stacked cards.

App Screens5 blocks37 lines
Open the full page for this page

Onboarding

A wizard for the session someone finishes and a checklist for the one they do not, with the only genuinely blocking step in front of both.

App Screens3 blocks45 lines
Open the full page for this page

Search Results

Built around the state a search page is in most of the time — empty — so recent queries lead and the facets sit in a sidebar that survives growing to twelve.

App Screens4 blocks47 lines
Open the full page for this page

Agent Run Detail

One run opened up in the order you would debug it — intent, actions, the retries that are invisible in both, then cost.

App Screens4 blocks49 lines
Open the full page for this page

Approvals Inbox

The queue, the same queue sorted by how long things have waited, and the policy that decided both — with the policy last so it is not scrolled past forever.

App Screens3 blocks45 lines
Open the full page for this page

Assistant Chat

The blank thread answered with real starter prompts, the model picker with the three numbers the choice turns on, and the four surfaces a session grows into — attachments, branches, canvas, threads.

App Screens6 blocks68 lines
Open the full page for this page

Agent Run Inspector

The three states an agent screen usually omits: the wait before the first token, the trace after something broke with retries costed in the open, and the diff it wants a person to accept.

App Screens5 blocks61 lines
Open the full page for this page

Retrieval Console

Why the answer said what it said: what is connected, how stale it is, what the query was allowed to see, what fitted in the window and what fell out — plus the failed-search state a debugging tool is most needed in.

App Screens7 blocks66 lines
Open the full page for this page

Records Table

A table after real people have used it — columns reordered from the keyboard, a selection bar that asks page-or-all, subtotals that survive collapsing, cells edited in place, and the empty state its own filters produced.

App Screens8 blocks71 lines
Open the full page for this page

Analytics

The saved view and the comparison window first, because every figure below depends on both — then six charts, none of which load a charting library.

App Screens8 blocks68 lines
Open the full page for this page

Alerting

Thresholds with how often each has actually fired, what that produced, where it went — and the digest settings that exist because of the answer.

App Screens5 blocks54 lines
Open the full page for this page

Import Data

The flow between an empty product and a useful one, in the order it goes wrong: sample data offered with equal weight, a file, a URL, the column mapping everything stalls on, and an upload that survives the connection dropping.

App Screens7 blocks64 lines
Open the full page for this page

Account Setup

A profile form where the role options state what they actually change, the avatar crop works from the keyboard, and a navigation guard names the fields it is about to throw away.

App Screens4 blocks53 lines
Open the full page for this page

App Shell

The furniture that is on every screen and belongs to none — navbar, mobile drawer, command palette, shortcut sheet, header search, scope switcher, and the two shapes a detail view takes without losing the list.

App Screens8 blocks68 lines
Open the full page for this page

Workspace Activity

Backwards from now and forwards from it on one screen — a day-grouped timeline, a month grid where a busy Tuesday never changes the row height, and the state both are in on day one.

App Screens3 blocks51 lines
Open the full page for this page

First Run

What the product looks like while onboarding happens: a tour step anchored to the control it explains, the skeletons of the slowest load it will ever do, and the checklist that outlives both.

App Screens3 blocks50 lines