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.
Owner:
States
Each state is one attribute.
DisabledRequiredOverview
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
| Attribute | Type | Default | Description |
|---|---|---|---|
value | string | — | The current text. |
label | string | Text | Accessible name, e.g. "Project name" (required for accessibility). |
placeholder | string | — | Shown while the value is empty. |
required | boolean | false | Refuse to save an empty value. |
disabled | boolean | false | Not editable. |
maxlength | number | — | Longest allowed value, in characters. |
save-labelprop: saveLabel | string | Save | Accessible name of the save (tick) button. |
cancel-labelprop: cancelLabel | string | Cancel | Accessible 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
| Event | React / Svelte prop | Description |
|---|---|---|
pm-change | onPmChange | A new value was saved. |
pm-cancel | onPmCancel | Editing was cancelled. |
CSS parts
| Part | Description |
|---|---|
::part(base) | The text shown while not editing. |
::part(input) | The input shown while editing. |
Methods
edit(), save(), cancel()