Fine-tune light, shadows, borders, neumorphic
Light and shadows
Borders
Neumorphic
Forms

InlineEdit <pm-inline-edit>

Inline edit: text that turns into an input in place, for renaming a project, a title or a table cell.

Full screen

Owner:

Props

<script type="module"> import '@prismora/css'; import '@prismora/elements/inline-edit'; </script> <div class="pm-stack" style="gap: var(--pm-space-3)"> <h3 class="pm-text-xl" style="margin: 0"> <pm-inline-edit label="Project name" value="Website redesign" required></pm-inline-edit> </h3> <p class="pm-muted" style="margin: 0"> Owner: <pm-inline-edit label="Owner" placeholder="Unassigned"></pm-inline-edit> </p> </div>

States

Each state is one attribute.

Disabled
Required

Overview

Click the text or its pencil button (or focus it and press Enter) to edit. Enter or the tick saves, Escape or the cross cancels, and leaving the field saves. Empty values are refused when required is set. Your code stores the value: listen for pm-change.

Attributes

AttributeTypeDefaultDescription
valuestring—The current text.
labelstringTextAccessible name, e.g. "Project name" (required for accessibility).
placeholderstring—Shown while the value is empty.
requiredbooleanfalseRefuse to save an empty value.
disabledbooleanfalseNot editable.
maxlengthnumber—Longest allowed value, in characters.
save-label
prop: saveLabel
stringSaveAccessible name of the save (tick) button.
cancel-label
prop: cancelLabel
stringCancelAccessible name of the cancel (cross) button.

Also accepts the contextual attributes tone, surface, radius, density, motion, elevation. They are inherited from ancestors' data-* attributes.

Events

EventReact / Svelte propDescription
pm-changeonPmChangeA new value was saved.
pm-cancelonPmCancelEditing was cancelled.

CSS parts

PartDescription
::part(base)The text shown while not editing.
::part(input)The input shown while editing.

Methods

edit(), save(), cancel()