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.
- modelValuerequiredstring | number—
- Current value (v-model target). Accepts string or number — the shape is preserved on emit.
- placeholderstring
- Placeholder shown on the native input and in the display affordance when modelValue is empty.
- rulesArray<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.
- validateTInlineEditValidator
- Single async-capable validator. Runs after all rules pass. On failure, surfaces the returned error message.
- autoFocusbooleantrue
- Auto-focus the native input when entering edit mode.
- selectOnFocusbooleantrue
- Select all input text on edit entry — useful for "click-to-rename" patterns.
- confirmOnBlurbooleantrue
- Commit the draft when the input loses focus. Set to false to require an explicit Enter.
- confirmOnEnterbooleantrue
- Commit on Enter key. Disable when multiline=true so Enter inserts a newline instead.
- cancelOnEscapebooleantrue
- Discard the draft and return to display mode on Escape.
- disabledbooleanfalse
- Disables the component — the display affordance becomes non-interactive and any in-flight edit is cancelled.
- multilinebooleanfalse
- Renders a <textarea> instead of an <input> in edit mode.
- trimbooleantrue
- Strip surrounding whitespace before emitting update:modelValue and before running validators.
- inputTypeTInlineEditInputType'text'
- Native HTML input type used in edit mode (ignored when multiline=true).
- loadingOnConfirmbooleanfalse
- Adds a CSS loading hook and sets aria-busy while an async validate Promise is in flight.
- showActionsbooleanfalse
- Renders built-in Edit / Confirm / Cancel icon buttons. When false, only keyboard shortcuts are available.
- idstring
- classstring | Array<string> | object
- stylestring | Array<string> | object | StyleValue
- tagstring'span'
- HTML element rendered at the root in display mode.
- fontSizeTFontSize
- fontWeightTFontWeight
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:modelValuestring | number
- Emitted after validation passes and the draft is committed. Same type as the modelValue prop.
- @editvoid
- Emitted when the component enters edit mode (display → input transition).
- @cancelvoid
- Emitted when the user cancels — the draft is discarded.
- @confirmstring | number
- Emitted after validation passes, before update:modelValue. Use to persist the value server-side.
- @validate-errorstring
- 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
With validation
Async validation