Skip to content

Inline editor ​

The input a field row swaps to while one field is edited.

metadata-inlinefieldeditor--editingOpen in Storybook ↗

When to use ​

  • It opens from a field row when you click its value. It is never placed on its own and never in a modal.

When not to use ​

  • Creating a new entity: use the form's inputs, such as a text input or a dropdown.
  • Rich text: that field has its own editor.

Anatomy ​

  1. Input: the input for the field type, bordered, as wide as the row. A checkbox is only as wide as its box. A textarea grows with its content up to --textarea-max-height.
  2. Save: a square icon button with a check, commit style. With nothing changed it just closes the editor.
  3. Cancel: a square icon button with a cross, secondary style.
  4. Error message (optional): --text-hint in --color-danger, under the input.
  5. Keyboard hint: --text-hint in --color-text-muted: Enter saves · Esc cancels, or Ctrl+Enter saves · Esc cancels for a textarea.

The buttons stay beside the input and never wrap under it, so an open dropdown menu can't cover them.

Variants ​

Field typeInput
Text, number, datetext input
Textareatext input in textarea mode
Checkboxcheckbox
Colourcolour input: the native picker and a hex field in one box
Dropdowndropdown, with a clear button unless the field is required; multiple for multi-select fields
Coordinatestwo number inputs, latitude and longitude
Relationautocomplete, with a Browse… link under it that opens the entity picker
Relation tablethe table with editable rows: add a row, change a cell, remove a row
metadata-inlinefieldeditor--field-typesOpen in Storybook ↗

A relation field, the most common editor on a detail page:

metadata-inlinefieldeditor--relationOpen in Storybook ↗

States ​

StateWhat you seeTrigger
Editingthe input has focusthe editor opens
Savinga spinner replaces both buttons; the input is disabledEnter, the save button, or leaving a changed field
Errordanger border on the input, the message under it; the value is kept and the editor stays openthe value is invalid, or the save failed
Savedthe editor closes; the row shows its saved check and the Entity successfully Updated notification showsthe save worked
metadata-inlinefieldeditor--statesOpen in Storybook ↗

Keyboard & accessibility ​

KeyIn the editor
Entersaves; with nothing changed, closes
Ctrl+Enter / ⌘+Entersaves a textarea (Enter adds a new line)
Escapecancels and restores the previous value
Tabmoves through the input and the buttons; leaving the editor saves a changed value
  • While a dropdown menu is open, Enter picks an option and Escape closes the menu. They don't save or cancel.
  • Picking an option or a date only changes the draft. The value saves when you press Enter, click save, or leave the field.
  • Leaving saves. A click outside or focus moving away saves a changed value and closes an unchanged editor. Clicks in the editor's own menus, date picker and dialogs count as inside.
  • One field at a time. Opening another field saves the changed one first. If that save fails, the changed field stays open with its error, and the other field does not open.
  • When the editor opens, the input gets focus. After save or cancel, focus returns to the value, unless you already moved it on.
  • The input is named after the field label. The buttons are named Save {label} and Cancel {label}.
  • The error message is role="alert". On a text input, an error also sets aria-invalid and links the message with aria-describedby.
  • Saving sends only this field and validates only this field.

Content ​

  • Error messages come from the field's validation and name the field, such as Title is required.
  • A save the server refuses shows Saving failed, try again.
  • Translation keys: inline-edit.save, inline-edit.cancel, inline-edit.hint, inline-edit.hint-textarea, inline-edit.saved, inline-edit.save-failed and inline-edit.browse.

Field row · Text input · Dropdown · Autocomplete · Entity picker

Powered by Elody - Open Source Semantic Data Platform