Community project. This is not an official government website.

Run by volunteers. Lampung Design System is built by an open source community. No government agency runs or endorses it.

Official services use go.id. Government websites in Indonesia end in .go.id. Never enter your national ID number on a site you are unsure of.

Inline edit

Inline edit

Click a name to rename it where it is: the text becomes a field with the same font and width, Enter or leaving saves, Escape puts it back. A save draws a small check; a refused save restores the old name, shakes, and says why.

Usage

Use it when

  • Renaming one thing in place: a project, a file, a note title, a group name.
  • A single short value that people change rarely and want to change without opening a form.

Use something else when

  • Several fields edited together: use Form layout.
  • A long text (a description, an answer): use Textarea.
  • A value chosen from a list: use Select.
  • A setting that applies at once: use Switch.

Where it goes. On the title itself: a page heading, a card title, the title of a list row. The pencil appears on hover and focus at the end of the text.

Examples

Rename a projectClick the name, type, press Enter. The check draws in; the new name stays. Escape restores the old one.
Project
<h1><span class="inline-edit" data-lds-inline>
  <button class="inline-edit__text" aria-label="Rename project"><span class="inline-edit__value">Thesis draft</span><span class="ic" aria-hidden="true">edit</span></button>
</span></h1>
<script type="module">
  document.querySelector('[data-lds-inline]').addEventListener('lds:save', (e) => {
    e.detail.wait(api.rename(e.detail.value)); // rejection restores e.detail.previous, shakes, announces
  });
</script>
Rename a file in a listIn a row the field takes the title's place and size; the size and date beside it do not move.
340 KB
1.1 MB
<div class="list" style="width: 100%; max-width: 440px;">
  <div class="lrow"><span class="ic" aria-hidden="true">description</span><span class="lrow__body"><span class="inline-edit" data-lds-inline><button class="inline-edit__text" aria-label="Rename Week 6 notes"><span class="inline-edit__value">Week 6 notes</span><span class="ic" aria-hidden="true">edit</span></button></span></span><span class="lrow__value">340 KB</span></div>
  <div class="lrow"><span class="ic" aria-hidden="true">description</span><span class="lrow__body"><span class="inline-edit" data-lds-inline><button class="inline-edit__text" aria-label="Rename Lab worksheet"><span class="inline-edit__value">Lab worksheet</span><span class="ic" aria-hidden="true">edit</span></button></span></span><span class="lrow__value">1.1 MB</span></div>
</div>

Anatomy

PartWhat it is
.inline-editRequired. data-lds-inline. Inherits the font of where it sits.
.inline-edit__textRequired. The button showing the value; aria-label says what it renames ("Rename project").
.inline-edit__valueRequired. The value text.
.inline-edit__inputThe field swapped in while editing (created by JS), same metrics, accent ring.
.inline-edit__stateThe check drawn after a save (created by JS).

States

StateHow
restText button; pencil hidden.
hover / focusTinted background and the pencil fades in over --d-fast.
editingAn input with the same font, at least the text width (80 px minimum), all text selected.
saved.is-saved: a check draws in 300 ms and goes after 1.8 s; "Saved" is announced.
refusedThe old value comes back, the wrapper shakes, and "Could not save. Restored the previous name." is announced.

Motion and microinteractions

  • Field in: lds-blur-in over --d-fast (160 ms) on --ease-enter, from 4 px below and blurred, at the same size as the text, so nothing around moves.
  • Saved: the check stroke draws (lds-draw) in 300 ms on --ease-enter.
  • Refused: shake() on the wrapper (360 ms) plus an error haptic.
  • Reduced motion: the field appears at once, the check appears without drawing, no shake.

Accessibility

  • The value is a real button whose aria-label names the action and object ("Rename project"). The input takes the same label.
  • Enter saves, Escape cancels and returns focus to the button, Tab saves (blur).
  • Results are announced in a polite status inside the component.

Do and don't

Do

  • Use it for one short value.
  • Pass the save promise to e.detail.wait() so failures roll back.
  • Name the object in the aria-label.

Don't

  • Chain several inline edits as a form.
  • Save on every keystroke.
  • Change the font size or width when the field appears.

Behavior and code

Plain HTML. [data-lds-inline] on init(). Emits lds:save with { value, previous, wait } only when the value changed and is not empty; wait(promise) shows the check on success, or restores, shakes and announces on rejection.