ui-kit0.0

Signature

Inline edit

Rename in place without moving.

Rename a project

Click the heading to edit it. The words do not move: the input has the same font, and its padding and border are cancelled out. Enter or blur saves, Esc cancels.

Click the name, type, then press Enter. Esc cancels.

When to use

  • Titles, names and short single-line values that are edited occasionally: a project name, a table cell, a detail row.
  • Where opening a form or dialog for one field would be heavy.
  • For several related fields, or long text, use a normal form with Field and Input.

In a list of details

Works at body size too. Each row is its own editor; there is no save button to hunt for.

Owner
Region
Billing email

Validation and saving

validate runs first and blocks saving with a message. onSave may return a promise: the field shows a spinner and stays read-only until it settles, and a thrown Error keeps the field open with its message. Try “Untitled” in the first example.

API

InlineEdit

PropTypeDefaultDescription
value / defaultValue / onValueChangestring—Controlled or uncontrolled value. onValueChange fires when a save succeeds.
onSave(next: string) => unknown | Promise<unknown>—Persist the value. A rejection shows its message and keeps the field open.
validate(next: string) => string | null | undefined—Return a message to block saving.
labelstring'Value'Accessible name, e.g. "Project name".
placeholderstring'Add a value'Shown when empty.
allowEmptybooleanfalseAllow saving an empty value.
emptyMessagestring'Can’t be empty'Error when empty is not allowed.
saveOnBlurbooleantrueBlur saves (true) or cancels (false).
selectOnEditbooleantrueSelect all text when editing starts.
maxLength, disablednumber, boolean—Native input limits.
onEditingChange(editing: boolean) => void—Editing started or ended.

Keyboard

KeyAction
Enter / SpaceOn the text: starts editing.
EnterIn the field: saves.
EscIn the field: cancels and restores the value.

Accessibility

  • At rest it is a real button (“Edit project name: Q4 launch plan”); editing swaps it for a labelled text input.
  • Errors use role="alert", aria-invalid and aria-describedby on the input. Pending sets aria-busy and makes the input read-only.
  • Focus returns to the text after Enter or Esc, but is not pulled back when you blur away.
  • Saved is announced through a polite live region.

Motion

  • No movement on the swap by design: the border, fill and focus ring fade in over 150ms while the text stays put.
  • The pencil hint fades in on hover (fine pointers) and focus; the save check pops in (220ms), then fades after 1.1 seconds. Errors rise in 220ms.
  • Reduced motion: the colours still change; the error and check appear with no rise or pop.