Usage
TheVOtpInput component creates individual input fields for each character of a one-time password.
Custom Length
Change the number of input fields:With Divider
Add separators between input fields:Masked Input
Hide the entered values:Text Type
Accept alphabetic characters:Loading State
Show a loading indicator:Custom Styling
Customize the appearance:Props
The v-model value of the component
The number of OTP input fields to display
The input type for the fields
Masks the input values similar to a password field
Text or symbol to display between input fields
Placeholder text for empty input fields
Automatically focuses the first input field on mount
Applies focused styling to all input fields when any field is focused
Disables all input fields
Displays a loading overlay. Pass a color string to customize the loader
Puts the input in an error state
Visual variant of the input fields
Applies specified color to the inputs when focused
Base color applied to the inputs
Background color of the input fields
Border radius applied to the input fields
Adjusts the vertical spacing
Sets the width of the component
Sets the height of the component
Aria-label for the input fields (supports i18n)
Slots
The default slot for additional content
Slot to customize the loading indicator
Events
Emitted when the OTP value changes
Emitted when all input fields are filled
Emitted when focus state changes
Methods
Focuses the first input field
Blurs all input fields
Clears all input values
The component automatically handles paste events, allowing users to paste the complete OTP code which will be distributed across all fields.
Keyboard navigation is fully supported with arrow keys to move between fields and backspace to delete and move to the previous field.