Skip to content
Protocore Design Systemv1.6.9

/// Inputs

Editable

Click-to-edit inline text: a quiet preview that swaps to an Input or Textarea on activate, committing on Enter or blur.

import { Editable } from "@protocore/pds";
View as Markdown

Basics

Render Editable with a value; clicking (or pressing Enter/Space on the preview) enters edit mode. Enter commits, Escape reverts, and blur commits by default.

Multiline

Set multiline to edit in an auto-growing Textarea. Enter inserts a newline; commit with blur or ⌘/Ctrl+Enter.

Controlled

Drive it from state with value + onValueChange, and react to commits with onSubmit.

Saved as: Q3 capacity plan

When to use it

Use Editable for in-place edits of a single short value that mostly reads as text — a document title, a display name, a table cell. When the field is always in edit mode, or sits in a form with a submit button, use a plain Input/Textarea in a Field instead.

Usage

Do

  • Give it an `aria-label` so both the preview and the field are named.
  • Provide a `placeholder` so an empty value still offers a target to click.
  • Use `onSubmit` to persist, not `onValueChange`, so you only save on commit.

Don't

  • Don't hide the only copy of critical data behind a click — show it, then let it edit.
  • Don't use it for long-form content that needs a full editor.
  • Don't set `submitOnBlur={false}` without making the commit affordance obvious.

Accessibility

KeysAction
Enter / SpaceFrom the preview, enter edit mode.
EnterCommit the edit (single-line).
⌘/Ctrl + EnterCommit the edit (multiline).
EscapeCancel and restore the previous value.
  • The preview is a real button, so it is focusable and keyboard-activatable.
  • Entering edit mode moves focus into the field and selects its contents.

Editable props

PropTypeDefaultDescription
aria-labelstringAccessible name for both the preview trigger and the edit field.
classNamestring
defaultValuestringInitial value when uncontrolled.
disabledbooleanPrevent entering edit mode.
multilinebooleanUse a Textarea instead of an Input; Enter inserts a newline, blur commits.
onCancel(() => void)Fires when the user abandons an edit with Escape.
onSubmit((value: string) => void)Fires with the committed value when the user confirms an edit (Enter / blur).
onValueChange((value: string) => void)Fires with the next value on every commit.
placeholderstringEmptyShown (muted) in the preview when the value is empty.
sizeenummdControl height for the edit field. Default `md`.
styleCSSProperties
submitOnBlurbooleantrueCommit on blur (default `true`); set `false` to require Enter and treat blur as cancel.
valuestringControlled value. Pair with `onValueChange`.

Related

  • InputThe base single-line text control — a sunken field with optional leading and trailing adornment slots.
  • TextareaSunken multi-line text control, with an opt-in auto-resize that grows the field to fit its content.
  • FieldForm-field wrapper: a caption label, the control, and hint or error messaging with ARIA wired for you.