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.

autofocus
boolean
false
Auto-focus the first cell on mount.
divider
string
Character or string rendered between digit groups (e.g. "-").
focusAll
boolean
false
Focus all cells simultaneously when the component is focused.
length
number | string
6
Number of OTP digit cells.
modelValue
number | string | null
Current OTP value (v-model).
persistentPlaceholder
boolean
false
Keep the placeholder visible even when the field has focus.
placeholder
string
Placeholder character shown in empty cells.
role
string
ARIA role applied to the root element.
type
TOtpInputFieldType
'number'
Input type for each digit cell.
active
boolean | IStateEffectConfig
label
string
Accessible label for the field.
style
string | Array<string> | object | StyleValue
text
string
size
TSize | number
id
string
disabled
boolean
false
Disables all digit cells.
class
string | Array<string> | object
focused
boolean
color
TColor
bgColor
TColor
border
boolean | number | string | TDirectionBoth | Array<TDirectionBoth>
borderColor
string
rounded
boolean | number | string | TRounded | null | undefined
elevation
TElevation
padding
boolean | number | string
margin
boolean | number | string
error
string | boolean
false
Forces the error state styling on all cells.
inline
boolean
name
string
fontSize
TFontSize
tag
string
paddingTop
boolean | number | string
paddingLeft
boolean | number | string
paddingBottom
boolean | number | string
paddingRight
boolean | number | string
paddingBlock
boolean | number | string
paddingInline
boolean | number | string
paddingInlineStart
boolean | number | string
paddingInlineEnd
boolean | number | string
paddingBlockStart
boolean | number | string
paddingBlockEnd
boolean | number | string
marginTop
boolean | number | string
marginLeft
boolean | number | string
marginBottom
boolean | number | string
marginRight
boolean | number | string
marginBlock
boolean | number | string
marginInline
boolean | number | string
marginInlineStart
boolean | number | string
marginInlineEnd
boolean | number | string
marginBlockStart
boolean | number | string
marginBlockEnd
boolean | number | string
borderTop
boolean | number | string
borderInlineStart
boolean | number | string
borderInlineEnd
boolean | number | string
borderInlineStartColor
TColor
borderInlineEndColor
TColor
borderLeft
boolean | number | string
borderBottom
boolean | number | string
borderRight
boolean | number | string
borderBlock
boolean | number | string
borderInline
boolean | number | string
borderBlockStart
boolean | number | string
borderBlockEnd
boolean | number | string
borderStyle
string
borderTopColor
TColor
borderRightColor
TColor
borderBottomColor
TColor
borderLeftColor
TColor
borderBlockStartColor
TColor
borderBlockEndColor
TColor
roundedStartStart
boolean | number | string
roundedStartEnd
boolean | number | string
roundedEndStart
boolean | number | string
roundedEndEnd
boolean | number | string
roundedTopRight
boolean | number | string
roundedTopLeft
boolean | number | string
roundedBottomLeft
boolean | number | string
roundedBottomRight
boolean | number | string
variant
TVariantInput
'outlined'
Visual variant applied to each digit cell.
loading
TControlLoadingValue
floating
boolean
density
TDensity
activeClass
string
loadingText
string
centerAffix
boolean
required
boolean
prefix
string
suffix
string
dirty
boolean
persistentClear
boolean
singleLine
boolean
appendInnerAvatar
string
appendInnerIcon
TIcon
prependInnerAvatar
string
prependInnerIcon
TIcon
clearIcon
TIcon
clearable
boolean
prependInnerAriaLabel
string
appendInnerAriaLabel
string
height
number | string
width
number | string
maxHeight
number | string
maxWidth
number | string
minHeight
number | string
minWidth
number | string
messages
Array<string> | string
errorMessages
Array<string> | string
maxErrors
number | string
readonly
boolean
false
Makes all cells non-editable without disabling them visually.
rules
Array<any>
validateOn
TValidateOn
validationValue
any
hint
string
hideDetails
boolean | string
hideSpinButtons
boolean
persistentHint
boolean
direction
TDirection

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.

@finish
string
Fired when all cells are filled. Payload is the complete OTP string.
@click:control
MouseEvent
Fired when the user clicks the field control area.
@mousedown:control
MouseEvent
Fired on mousedown on the field control area.
@update:modelValue
any
Fired on each keystroke as the OTP value changes.
@update:focused
any
@click:appendInner
MouseEvent
@click:prependInner
MouseEvent
@click:clear
MouseEvent
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

vue

With divider

vue

Password type

vue