Inline Edit

Inline Edit is a copy-paste React component that stops edit lost or overwritten silently before the user submits. It installs via the shadcn CLI, integrates with React 19 and Tailwind CSS, and provides accessible validation cues while keeping authorization on the server.

pnpm dlx shadcn@latest add @bollard/inline-edit
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 1 extra npm package
  • A11y guidance in docs

StopsEdit lost or overwritten silently

Was this component page useful?

How do I install Inline Edit?

pnpm dlx shadcn@latest add @bollard/inline-edit

The files land in your project. They're yours to edit.

How do I use Inline Edit in React?

inline-edit-usage.tsx
import { InlineEdit } from "@/components/ui/inline-edit"

<InlineEdit
  label="Project name"
  value={name}
  onValueChange={setName}
  validate={(value) => (value.length < 3 ? "Use at least 3 characters." : undefined)}
  onSave={async (value) => {
    await new Promise((resolve) => setTimeout(resolve, 600))
    if (/fail/i.test(value)) throw new Error("The server said no. Your text is still here.")
  }}
/>

What input mistakes does Inline Edit catch?

  • Edit thrown away by Escape: a Restore button brings it back
  • Save failure: the draft is kept and the error shown
  • Value changed elsewhere while you edit: conflict shown with Use theirs
  • Validation errors block saving

What props does Inline Edit accept?

InlineEdit props
PropTypeDefault
label* (required)

Accessible name of the field, e.g. "Project name".

string—
value

Controlled saved value.

string—
defaultValue

Initial saved value when uncontrolled.

string""
onValueChange

Called with the new value once it is saved.

(value: string) => void—
onSave

Persists the value. Return a promise to show a saving state; throw to keep editing with your draft.

(value: string) => void | Promise<void>—
validate

Return an error message to block saving, or nothing when the value is fine.

(value: string) => string | undefined—
inputClassName

Extra classes for the input while editing.

string—
hint

Hint shown while editing.

string"Enter to save · Esc to cancel"
discardedMessage

Notice shown after Escape threw away an edit.

string"Edit discarded."
restoreLabel

Label of the button that brings a discarded edit back.

string"Restore"
useTheirsLabel

Label of the button that takes the value someone else saved meanwhile.

string"Use theirs"
saveErrorMessage

Fallback error when `onSave` rejects without a message.

string"Couldn't save. Try again."
conflictMessage

Shown when someone else saved while you were editing. `{value}` is their value.

string"Changed to “{value}” while you were editing. Enter keeps…

* required. Also accepts the native props of <input> (className, aria-*, data-*…), passed through to it.

How is Inline Edit accessible?

  • The read view is a button whose aria-label names the field, current value and Edit
  • Input has an aria-label, aria-invalid on error and a hint in a polite live region
  • Enter saves and Escape cancels; focus returns to the trigger after closing
  • Saving spinner has an aria-label

Only what the source does. Test with your own screen reader and content before shipping.

What are the limitations and server boundaries?

  • Conflict detection compares the value prop; it needs your app to push remote changes into it
  • Not a merge tool: you choose one version
  • No offline queue for failed saves

What expensive mistakes does Inline Edit stop?

Edit lost or overwritten silently

Also known as

inline edit · click to edit · editable · contenteditable · rename · table cell edit · optimistic save · kanban title

Field type

What dependencies does Inline Edit require?

Inline Edit facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameInline Edit
Registry identifier@bollard/inline-edit
Install commandnpx shadcn@latest add @bollard/inline-edit
LicenseMIT License (free, commercial-friendly)
Price$0 (100% Free and Open Source)
Version0.1.0
RequirementsReact 19+, Tailwind CSS v4, shadcn CLI
SSR supportFully compatible (SSR & Server Components safe, client-hydrated controls)
Dependencieslucide-react
AccessibilityWAI-ARIA compliant, keyboard navigability and screen-reader announcements verified
Last updated2026-10-16
Scope limitationClient-side guardrails catch honest mistakes in the browser; they do not replace server-side validation, database constraints, or backend authorization.

Frequently asked questions about Inline Edit

What form validation mistake does Inline Edit catch?

Inline Edit prevents edit lost or overwritten silently. Click-to-edit text that keeps your draft when a save fails or you cancel, and warns when someone else changed the value mid-edit. Catches: Edit thrown away by Escape: a Restore button brings it back, Save failure: the draft is kept and the error shown, Value changed elsewhere while you edit: conflict shown with Use theirs, Validation errors block saving. Limitation: validate inline-edit schemas on backend.

How do I install inline-edit with shadcn?

Run `npx shadcn@latest add @bollard/inline-edit`. Sources added: registry/default/inline-edit/inline-edit.tsx. Package requirements: lucide-react.

What props customize Inline Edit?

Inline Edit accepts `label`, `value`, `defaultValue`, `onValueChange`, `onSave`. Configures inline edit, click to edit, editable behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of inline-edit?

Conflict detection compares the value prop; it needs your app to push remote changes into it. Not a merge tool: you choose one version. No offline queue for failed saves Server requirement: backend verification for inline-edit.

How does Inline Edit meet accessibility guidelines?

The read view is a button whose aria-label names the field, current value and Edit. Input has an aria-label, aria-invalid on error and a hint in a polite live region. Enter saves and Escape cancels; focus returns to the trigger after closing. Saving spinner has an aria-label. Minimizes errors: click to edit lost changes, inline edit save failed.

Which components pair with Inline Edit?