Eingabe für Einmalcodes: Ein echtes verstecktes Feld übernimmt Tippen, Einfügen und SMS-Autofill, während animierte Slots den Code mit blinkendem Textcursor, einem Trenner und einem Fehler-Schütteln anzeigen.
Accepted characters; “numeric” opens the number pad on mobile.
case
upper | lower
Forces the case of typed characters.
separator
boolean | "3" | "2,4"
Visual separator: in the middle if empty, otherwise after the given positions.
mask
boolean
Masks the characters (•), for a PIN.
placeholder
string
Character(s) shown in empty slots (e.g. “-” or “000000”).
value
string
Initial value (and form reset value).
name
string
Field name in the form.
required
boolean
Invalid until every slot is filled.
invalid
boolean
Error state (red border + shake when set); cleared on the next input.
valid
boolean
Success state (green border and tint); cleared on the next input.
disabled
boolean
Disables input.
label
string
Accessible name when no <label for> is associated.
data-size
sm | lg
Slot size.
Properties
Name
Typ
Description
value
string
Current code (filtered and truncated).
complete
boolean
Read-only: every slot is filled.
form / validity / validationMessage
-
Native form API (ElementInternals).
Methods
Name
Description
focus()
Focuses the real input.
clear()
Clears the code and the valid/invalid states.
shake()
Plays the shake animation.
checkValidity() / reportValidity()
Native validation.
Events
Name
Description
mv-change
detail: { value, complete } on every change.
mv-complete
detail: { value } when the last slot is filled.
CSS classes
Name
Description
mv-otp-slot / -char / -caret / -separator
Generated parts (data-active, data-filled).
CSS variables
Name
Default
Description
--mv-otp-slot-width
2.75rem
Slot width.
--mv-otp-slot-height
3rem
Slot height.
--mv-otp-gap
var(--mv-space-2)
Space between slots.
--mv-otp-radius
var(--mv-radius-md)
Slot radius.
Accessibility
A single real <input> (autocomplete="one-time-code", numeric inputmode) holds focus and the accessible name (from <label for>, label or aria-label); the visual slots are aria-hidden. Arrow keys, Home/End, Backspace and Delete move between slots; pasting spreads the code. aria-invalid reflects the error state; form-associated element with native validation.