InlineEdit

Form & Input
stable

Edit-in-place component with sync/async validation, keyboard shortcuts and optional action buttons.

API

Props

All props accepted by this component, with their type, default value and description.

modelValue
required
string | number
—
Current value (v-model target). Accepts string or number — the shape is preserved on emit.
placeholder
string
Placeholder shown on the native input and in the display affordance when modelValue is empty.
rules
Array<TInlineEditRule>
Array of validation rules. Each rule receives the current value and returns true (pass) or an error message string (fail). Evaluated before the validate callback.
validate
TInlineEditValidator
Single async-capable validator. Runs after all rules pass. On failure, surfaces the returned error message.
autoFocus
boolean
true
Auto-focus the native input when entering edit mode.
selectOnFocus
boolean
true
Select all input text on edit entry — useful for "click-to-rename" patterns.
confirmOnBlur
boolean
true
Commit the draft when the input loses focus. Set to false to require an explicit Enter.
confirmOnEnter
boolean
true
Commit on Enter key. Disable when multiline=true so Enter inserts a newline instead.
cancelOnEscape
boolean
true
Discard the draft and return to display mode on Escape.
disabled
boolean
false
Disables the component — the display affordance becomes non-interactive and any in-flight edit is cancelled.
multiline
boolean
false
Renders a <textarea> instead of an <input> in edit mode.
trim
boolean
true
Strip surrounding whitespace before emitting update:modelValue and before running validators.
inputType
TInlineEditInputType
'text'
Native HTML input type used in edit mode (ignored when multiline=true).
loadingOnConfirm
boolean
false
Adds a CSS loading hook and sets aria-busy while an async validate Promise is in flight.
showActions
boolean
false
Renders built-in Edit / Confirm / Cancel icon buttons. When false, only keyboard shortcuts are available.
id
string
class
string | Array<string> | object
style
string | Array<string> | object | StyleValue
tag
string
'span'
HTML element rendered at the root in display mode.
fontSize
TFontSize
fontWeight
TFontWeight

API

Slots

Content slots exposed by this component.

#display
Replaces the default display affordance with a custom element. Call edit() to switch to edit mode.
#edit
Replaces the native input in edit mode with a fully custom input layout while keeping the same state machine.
#actions
Custom confirm / cancel buttons. Receives confirm(), cancel() and isPending.

API

Emits

Events emitted by this component.

@update:modelValue
string | number
Emitted after validation passes and the draft is committed. Same type as the modelValue prop.
@edit
void
Emitted when the component enters edit mode (display → input transition).
@cancel
void
Emitted when the user cancels — the draft is discarded.
@confirm
string | number
Emitted after validation passes, before update:modelValue. Use to persist the value server-side.
@validate-error
string
Emitted when a rule or the validate callback returns an error message.

Interactive

Playground

Edit props live and see the component update in real time. The generated code snippet updates as you change values.

Rendering the live preview…

Usage

Examples

Ready-to-paste code snippets for your templates.

Click-to-edit

vue

With validation

vue

Async validation

vue