Skip to content
界面图谱Interface Atlas
☰
中文
PatternsInteraction / Forms

Inline Editing

行内编辑

Aliases:Inline Editing行内编辑就地编辑点击变输入框原地编辑即点即改单击编辑

What is it

The text on the page is itself the editor: a click swaps it for an input in place, Enter or blur commits, Escape cancels — what you fix is what you see. It solves the overhead of a full edit page for tiny changes, driving the cost of a correction down to a single click, ideal for quick single-field revisions.

Interactive playground

Try it. Make an informed choice.

Loading lab…

✓ When to use

  • Quick single-field edits like doc titles and display names
  • Lightweight revisions on kanban cards and table cells
  • Low-risk text that is easy to revert

✕ When not to use

  • Fields with complex validation or cross-field logic
  • Error-prone zones without an explicit edit affordance
  • Flows needing drafts, versions or other edit context

Variants

Click to edit

点击编辑

Static text and input swap in place

Hover affordance

悬停提示

A dotted underline or pencil icon appears on hover to signal editability

Commit and cancel

确认与取消

Enter or blur commits; Escape reverts and exits

Implementation

contenteditablefocus outlineborder-accentaria-live

Two-state swap: render a button (or role="button" text) when idle, and an auto-focused, select-all input/textarea when editing. Enter (Shift+Enter for newlines) or blur commits, Escape reverts, empty input falls back to the original. A hover dotted underline signals editability; add a subtle height transition if sizes differ.

Related concepts

Input输入框

A single-line bordered field for collecting text — the basic unit of every form. Placeholder hints the expected format, focus highlights the border to guide the eye, and failed validation switches to an error color with a hint. Prefix and suffix icons or a clear button can live inside, and the value is controlled state.

ComponentsUsed with
Textarea多行输入框

A growing multi-line field for long text — bios, notes, messages and feedback. It grows manually or automatically, usually paired with a counter and submit button; the count turns red past the limit and content wraps instead of clipping.

ComponentsUsed with
Form Validation表单校验

Checks input validity during typing or at submit and surfaces errors right next to the offending field. The goal is to tell users, with minimal interruption and maximum locality, what went wrong and how to fix it — instead of bouncing them back with a page of errors after submit.

PatternsSimilar
Optimistic UI乐观界面

Update the interface immediately as if the operation will succeed while the real request runs in the background; settle on success, roll back to the original state with a notice on failure. It solves the "wait for the server on every action" problem — trading brief uncertainty for a zero-latency feel, ideal for frequent light actions like likes and bookmarks.

PatternsSimilar
Button按钮

A clickable block that triggers one clear action — the most basic interactive element of any interface. Fill, outline and ghost styles rank primary against secondary actions; presses give instant sink-in feedback, and a busy state disables further clicks to prevent double submission.

ComponentsUsed with

Sources

Markdown for agents · JSON