How to build an accessible Editable in React

The preview renders as a real <button> so it is keyboard-focusable and announces as an actionable control; while editing, Enter confirms and Escape cancels, and focus is moved into the input and its text selected so keyboard users can immediately type.

When to use a Editable

When not to use it

Keyboard interactions

Role button, verified at WCAG 2.2-AA.

Common mistakes

Avoid: <Editable value={email} onValueChange={save} /> as a primary form control

Prefer: <Input label="Email" value={email} onChange={...} />

Inline edit hides the affordance behind a click; required form fields should be visibly editable from the start

Example

<Editable value="Click to edit" onValueChange={() => {}} />

See the full Editable reference →