InlineEdit
Form & Input
stable
Edit-in-place component with sync/async validation, keyboard shortcuts and optional action buttons.
API
Props
Toutes les props acceptées par ce composant, avec leur type, valeur par défaut et description.
- modelValuerequisstring | 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
Emplacements de contenu exposés par ce composant.
- #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
Événements émis par ce composant.
- @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.
Interactif
Playground
Modifiez les props en direct et observez le composant se mettre à jour. Le snippet de code généré suit vos changements.
Rendu de l’aperçu en cours…
Usage
Exemples
Extraits de code prêts à coller dans vos templates.
Click-to-edit
With validation
Async validation