OtpInputField
Form & Input
stable
One-time password input with auto-advance between cells.
API
Props
Toutes les props acceptées par ce composant, avec leur type, valeur par défaut et description.
- autofocusbooleanfalse
- Auto-focus the first cell on mount.
- dividerstring
- Character or string rendered between digit groups (e.g. "-").
- focusAllbooleanfalse
- Focus all cells simultaneously when the component is focused.
- lengthnumber | string6
- Number of OTP digit cells.
- modelValuenumber | string | null
- Current OTP value (v-model).
- persistentPlaceholderbooleanfalse
- Keep the placeholder visible even when the field has focus.
- placeholderstring
- Placeholder character shown in empty cells.
- rolestring
- ARIA role applied to the root element.
- typeTOtpInputFieldType'number'
- Input type for each digit cell.
- activeboolean | IStateEffectConfig
- labelstring
- Accessible label for the field.
- stylestring | Array<string> | object | StyleValue
- textstring
- sizeTSize | number
- idstring
- disabledbooleanfalse
- Disables all digit cells.
- classstring | Array<string> | object
- focusedboolean
- colorTColor
- bgColorTColor
- borderboolean | number | string | TDirectionBoth | Array<TDirectionBoth>
- borderColorstring
- roundedboolean | number | string | TRounded | null | undefined
- elevationTElevation
- paddingboolean | number | string
- marginboolean | number | string
- errorstring | booleanfalse
- Forces the error state styling on all cells.
- inlineboolean
- namestring
- fontSizeTFontSize
- tagstring
- paddingTopboolean | number | string
- paddingLeftboolean | number | string
- paddingBottomboolean | number | string
- paddingRightboolean | number | string
- paddingBlockboolean | number | string
- paddingInlineboolean | number | string
- paddingInlineStartboolean | number | string
- paddingInlineEndboolean | number | string
- paddingBlockStartboolean | number | string
- paddingBlockEndboolean | number | string
- marginTopboolean | number | string
- marginLeftboolean | number | string
- marginBottomboolean | number | string
- marginRightboolean | number | string
- marginBlockboolean | number | string
- marginInlineboolean | number | string
- marginInlineStartboolean | number | string
- marginInlineEndboolean | number | string
- marginBlockStartboolean | number | string
- marginBlockEndboolean | number | string
- borderTopboolean | number | string
- borderInlineStartboolean | number | string
- borderInlineEndboolean | number | string
- borderInlineStartColorTColor
- borderInlineEndColorTColor
- borderLeftboolean | number | string
- borderBottomboolean | number | string
- borderRightboolean | number | string
- borderBlockboolean | number | string
- borderInlineboolean | number | string
- borderBlockStartboolean | number | string
- borderBlockEndboolean | number | string
- borderStylestring
- borderTopColorTColor
- borderRightColorTColor
- borderBottomColorTColor
- borderLeftColorTColor
- borderBlockStartColorTColor
- borderBlockEndColorTColor
- roundedStartStartboolean | number | string
- roundedStartEndboolean | number | string
- roundedEndStartboolean | number | string
- roundedEndEndboolean | number | string
- roundedTopRightboolean | number | string
- roundedTopLeftboolean | number | string
- roundedBottomLeftboolean | number | string
- roundedBottomRightboolean | number | string
- variantTVariantInput'outlined'
- Visual variant applied to each digit cell.
- loadingTControlLoadingValue
- floatingboolean
- densityTDensity
- activeClassstring
- loadingTextstring
- centerAffixboolean
- requiredboolean
- prefixstring
- suffixstring
- dirtyboolean
- persistentClearboolean
- singleLineboolean
- appendInnerAvatarstring
- appendInnerIconTIcon
- prependInnerAvatarstring
- prependInnerIconTIcon
- clearIconTIcon
- clearableboolean
- prependInnerAriaLabelstring
- appendInnerAriaLabelstring
- heightnumber | string
- widthnumber | string
- maxHeightnumber | string
- maxWidthnumber | string
- minHeightnumber | string
- minWidthnumber | string
- messagesArray<string> | string
- errorMessagesArray<string> | string
- maxErrorsnumber | string
- readonlybooleanfalse
- Makes all cells non-editable without disabling them visually.
- rulesArray<any>
- validateOnTValidateOn
- validationValueany
- hintstring
- hideDetailsboolean | string
- hideSpinButtonsboolean
- persistentHintboolean
- directionTDirection
API
Slots
Emplacements de contenu exposés par ce composant.
- #default
- Default slot for additional content inside the field.
- #field
- Replaces the digit cells with a fully custom input implementation.
- #label
- #clear
- #prependInner
- Content placed inside the field wrapper before the digit cells.
- #appendInner
- Content placed inside the field wrapper after the digit cells.
- #loader
- Custom loader shown while loading=true.
- #floatingLabel
- #prefix
- #suffix
- #details
- #prepend
- #append
- #messages
- #message
API
Emits
Événements émis par ce composant.
- @finishstring
- Fired when all cells are filled. Payload is the complete OTP string.
- @click:controlMouseEvent
- Fired when the user clicks the field control area.
- @mousedown:controlMouseEvent
- Fired on mousedown on the field control area.
- @update:modelValueany
- Fired on each keystroke as the OTP value changes.
- @update:focusedany
- @click:appendInnerMouseEvent
- @click:prependInnerMouseEvent
- @click:clearMouseEvent
- Fired when the clear button is clicked.
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.
Basic 6-digit OTP
With divider
Password type