Installation
templui add inputotpLoad the script once in your layout:
<head>
@inputotp.Script()
</head>Examples
Placeholder
With Label
Custom Length
Password Type
Custom Styling
Form
Enter the 6-digit code sent to your phone
Invalid verification code.
API Reference
InputOTP
Main container for the OTP input component.
| Name | Type | Default |
|---|---|---|
Unique identifier for the OTP input component | | |
Additional CSS classes to apply to the container | | |
Additional HTML attributes to apply to the container | | |
Current value of the OTP input | | |
Name attribute for the hidden input field | | |
Whether the OTP input should display error styling | | |
Group
Container for grouping OTP slots together.
| Name | Type | Default |
|---|---|---|
Unique identifier for the group element | | |
Additional CSS classes to apply to the group | | |
Additional HTML attributes to apply to the group | | |
Slot
Individual input slot for a single character.
| Name | Type | Default |
|---|---|---|
Unique identifier for the slot element | | |
Additional CSS classes to apply to the slot | | |
Additional HTML attributes to apply to the slot | | |
Index position of this slot in the OTP sequence | | |
Input type for the slot (text or password) | | |
Placeholder text for the slot | | |
Whether the slot is disabled | | |
Separator
Visual separator between groups of slots.
| Name | Type | Default |
|---|---|---|
Unique identifier for the separator element | | |
Additional CSS classes to apply to the separator | | |
Additional HTML attributes to apply to the separator | | |