npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-inline-edit.json --yesInline edit
ProWords that read as plain text and become an editable field in place, such as a record's title or a property's value, for React and Tailwind CSS. Part of Goop Pro.
What an agent sees
import { useState } from 'react';
import { InlineEdit } from '@/components/ui/goop/inline-edit';
import { Progress } from '@/components/ui/goop/progress';
import { Properties, PropertyRow } from '@/components/ui/goop/properties';
function Visit() {
const [title, setTitle] = useState('Survey the ridge path before the spring walk');
const [place, setPlace] = useState('North meadow');
return (
<div className="flex w-80 flex-col gap-4">
<InlineEdit as="h1" variant="title" multiline label="Title" value={title} onValueChange={setTitle} />
<Properties>
<PropertyRow label="Place">
<InlineEdit value={place} onValueChange={setPlace} placeholder="Add a place" />
</PropertyRow>
</Properties>
</div>
);
}Click the title, the site, the empty contact or the note (or Tab onto one and press Enter, Space or F2) and type: Enter or a click away saves, Escape puts the words back, and in the title and the note Shift+Enter breaks the line. The line under the record says what the last save or Escape did. The study is our own and lives in this page alone: nothing is saved anywhere.
When to use
- Words that read as plain text and become an editable field in place, such as a record's title or a property's value.
Installation
Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Inline edit on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing. As a Pro part, its command comes from Goop's server once you sign in, with a one-time link that lasts ten minutes.
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-inline-edit.json --yesAdd the Goop Inline edit to this project. The install steps are at https://goop.so/docs/install.mdUsage
import { useState } from 'react';
import { InlineEdit } from '@/components/ui/goop/inline-edit';
import { Progress } from '@/components/ui/goop/progress';
import { Properties, PropertyRow } from '@/components/ui/goop/properties';
function Visit() {
const [title, setTitle] = useState('Survey the ridge path before the spring walk');
const [place, setPlace] = useState('North meadow');
return (
<div className="flex w-80 flex-col gap-4">
<InlineEdit as="h1" variant="title" multiline label="Title" value={title} onValueChange={setTitle} />
<Properties>
<PropertyRow label="Place">
<InlineEdit value={place} onValueChange={setPlace} placeholder="Add a place" />
</PropertyRow>
</Properties>
</div>
);
}- Fits: record (its recipe).
- Also known as: Editable, EditableText, ClickToEdit.
- height, width, padding, corner, text, motion: add no class for these.
API reference
| Option | Type | What it does |
|---|---|---|
| variant | default | title = default | |
| value? | string | The saved words (controlled); pair it with onValueChange. |
| defaultValue? | string = '' | The words it starts with (uncontrolled). |
| onValueChange? | (value: string) => void | Called with the new words when a save changes them (Enter, or the focus leaving), never while typing. |
| onSave? | (value: string) => void | Called with the words on every save, changed or not, after onValueChange. |
| onCancel? | () => void | Called when Escape ends the editing and puts the saved words back. |
| label? | string | What the value is, for a screen reader: the button reads "Edit <label>" and the field is named <label>. |
| placeholder? | string | The words shown, in the placeholder grey, while the value is empty; the field's own placeholder too. |
| multiline? | boolean = false | A multi-line field (a textarea growing with its words): Enter saves, Shift+Enter breaks the line. |
| disabled? | boolean = false | Off: the words read and nothing opens them. |
| as? | 'div' | 'span' | 'p' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' = 'div' | The element round the words in both states: a div by default, h1 for a page's title. |
| id? | string | The control's id (the reading button's, then the field's): what a <label htmlFor> points at. |
- State: value (value / defaultValue / onValueChange)
- Class recipes (cva): inlineEditVariants (InlineEdit)
- data-slot values (to select a part by): inline-edit, inline-edit-input, inline-edit-text, inline-edit-trigger
Keyboard
| Key | What it does |
|---|---|
| Enter Space F2 | On the words: open the field holding them, focused, the words chosen |
| Enter | In the field: save the words and put the focus back on them (Shift+Enter breaks the line in a multi-line field) |
| Escape | In the field: put the saved words back and the focus on them; a dialog round it stays open |
| Tab | In the field: save the words and move on to the next control |
Accessibility
- The native element answers the keyboard.
- hover, active, focus-visible: the browser's own (:hover, :active, :focus-visible): write nothing
Its states are drawn from attributes and props, so assistive technology and your agent read the same thing:
| State | Drawn by |
|---|---|
| disabled | the prop disabled |
Motion
- The part sets its own motion: add no transition or animation of your own.
Notes for AI
Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.