OtpInput
Reusable otp input component.
Usage
Components are auto-discovered. Use the component directly in any .wrn view:
<OtpInput
name="otp"
length="6"
label="Verification code"
/>Legacy mount name: data-component="OtpInput".
Props and attributes
| Prop | Type | Requirement | Default |
|---|---|---|---|
class | string | Optional | "" |
name | string | Optional | "otp" |
length | number | Optional | 6 |
label | string | Optional | "Verification code" |
Slots
This component does not declare a slot.
Events
This component does not declare a custom event.
Source contract
Installed source: components/OtpInput.wrn
component OtpInput {
props {
class = ""
name = "otp"
length = 6
label = "Verification code"
}
view {
<fieldset class="{class}">
<legend class="mb-3 text-sm font-semibold">{label}</legend>
<input name="{name}" inputmode="numeric" autocomplete="one-time-code" maxlength="{length}" pattern="[0-9]*" class="min-h-14 w-full rounded-2xl border border-slate-300 bg-white px-4 text-center font-mono text-2xl tracking-[0.5em] outline-none transition focus:border-violet-500 focus:ring-4 focus:ring-violet-500/10 dark:border-slate-700 dark:bg-slate-950" />
</fieldset>
}
}