Skip to content
IndexRequest a UIAboutContact

Inline Edit Text

A title that becomes an input when clicked: Enter or blur saves, Escape cancels, and an empty name is rejected.

Open alone ↗

AI prompt

PROMPT: PASTE INTO YOUR AI CODING TOOL
Clean UI design of an editable project title: the heading Quarterly roadmap in bold with a small grey pencil icon at its right, below it a second state where the heading has turned into a text input with a dark one pixel border and the text selected in blue, a small hint Enter to save, Esc to cancel, light theme, flat modern style, plenty of white space. Variants: an error state with a red border and the message Name can't be empty. Negative: modal dialogs, heavy shadows, text errors, clutter. Reduced motion: static design.

About this pattern

Definition

Inline editing lets people change a value where they see it instead of opening a form. The text looks plain until hovered, shows a pencil to hint it can change, turns into an input on click or Enter, and returns to text when saved or cancelled.

Purpose & UX principles

  • Enter saves, Escape cancels, blur saves; select all text on entering edit mode.
  • Validate before saving; show an error and keep editing if the value is empty.
  • Use a real button around the text so it is focusable and can be opened with the keyboard.

Interaction states

  • A project title you can click, plus a second field for a short description.

Motion specification

  • The input appears instantly; the Saved message fades after 1.5s.
  • Reduced motion: no fade.

Responsive behaviour

  • Return focus to the text button after saving or cancelling.
  • Announce Saved or the error in a status message.

Code

HTML
<div class="bx"><div class="fd"><span class="lb">Project name</span><span id="slot"></span></div><div class="fd"><span class="lb">Description</span><span id="slot2"></span></div><p class="out" id="out" role="status"></p></div>

Related patterns

Text Input

↗
Text InputInputs & Forms

Validation States

↗
Validation StatesInputs & Forms

Copy Feedback Button

↗
Copy Feedback ButtonMicro Interactions