---
agent:
  instructions: "Search goop.so for Goop's components, templates, design skill, docs, pricing and terms. Ask in keywords or a plain question, such as \"date picker props\" or \"is the design skill free\"; the answer is the matching page sections in Markdown, each with its address."
  endpoint: "https://goop.so/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Inline edit

Words 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.

Pro. Its export: `InlineEdit`.

## Try it

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.

```sh
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-inline-edit.json --yes
```

```text
Add the Goop Inline edit to this project. The install steps are at https://goop.so/docs/install.md
```

## Usage

```tsx
import { InlineEdit } from '@/components/ui/goop/inline-edit';
import { useState } from 'react';
import { Properties, PropertyRow } from '@/components/ui/goop/properties';

function Study() {
  const [title, setTitle] = useState('Recruit 8 participants for the Diallo Dental study');
  const [site, setSite] = useState('Station Road Surgery');
  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="Site">
          <InlineEdit value={site} onValueChange={setSite} placeholder="Add a site" />
        </PropertyRow>
      </Properties>
    </div>
  );
}
```

- Fits: record (its recipe).
- Also known as: Editable, EditableText, ClickToEdit.
- height, width, padding, corner, background, text, motion: add no class for these.

## API reference

### Options

- `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, 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 ("Edit <label>").
- `placeholder?: string` — The words shown while the value is empty.
- `multiline?: boolean = false` — A growing textarea: 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 (`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)

## Keyboard

- 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
- 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.

## Related

- [Properties](/themes/trail/components/properties): A record's properties, each a label and a value edited in place, such as status, assignee and dates, for a record's side panel.
- [Profile card](/themes/trail/components/profile-card): A person's own page header, for an account, profile, customer or patient page.
- [Promo card](/themes/trail/components/promo-card): A card that offers something (an app to download, a plan to upgrade to, a feature that is new), for a page or a settings pane.
- [Reply actions](/themes/trail/components/reply-actions): The row of actions under an AI answer that copies it, rates it good or bad and asks for it again.
