Toggle Sidebar B
AppearanceLight & dark mode D

Code Slots

One-time code input where each digit lands into its slot on a spring, a rejected code drains away slot by slot, and an accepted one merges into a single wash with a check.

Default

Type or paste a six digit code. Switch the outcome in the panel to see it accepted or rejected.

Dark previewReplay previewOpen in new tab
0 of 6 digits entered

Customize

Accent
Ink
Slot
Digit
Danger
Length6
Outcome
Slot Size44px
Gap8px
Radius12px
Bounce0.2
Settle0.3s
Rise8px
Cascade20ms

API Reference

CodeSlots

PropTypeDefaultDescription
lengthnumber6Number of slots.
valuestringundefinedControlled code, bound with v-model:value. Digits that arrive from outside land with the cascade, digits removed drain.
defaultValuestring''Uncontrolled initial code, rendered already landed.
status'idle' | 'error' | 'success''idle'error drains the slots last to first under the danger tint and clears the code. success merges the fills into one wash and locks the input.
maskbooleanfalseShows a dot instead of each digit.
caretbooleantrueShows the blinking caret in the active slot.
disabledbooleanfalseFades the row and ignores input.
autoFocusbooleanfalseFocuses the input on mount.
accentColorstring'#f5f5f5'Fill of a landed digit, the active ring and the success wash.
inkColorstring'#f5f5f5'Caret, and the tint of the active slot.
slotColorstring'#27272a'Surface of an empty slot.
digitColorstring'#18181b'Digit colour on the fill.
dangerColorstring'#ff3b30'Ring and fill colour while status is error.
slotSizenumber44Slot width in pixels. Height and digit size follow it.
gapnumber8Space between slots in pixels.
radiusnumber12Corner radius in pixels, capped at half the slot size.
bouncenumber0.2Spring overshoot of the landing fill. 0 is critically damped.
settlenumber0.3Seconds a digit takes to land or drain.
risenumber8Pixels a digit rises into place. 0 fades only.
cascadenumber20Milliseconds between slots when several land at once or drain on reject.
ariaLabelstring'One-time code'Accessible name of the input.
EventDescription
changeEmitted on every edit with the code, including the clear at the end of a reject.
completeEmitted once with the code when the last hole is filled.
update:valueEmitted alongside change, for v-model:value.

Accessibility

Keyboard shortcuts and ARIA behavior.

Shortcut Description
0-9Fills the active slot.
Backspace + DeleteClears the slot, Backspace steps back when it is already empty.
Arrow Left + Arrow RightMoves the caret between slots.
Home + EndMoves the caret to the first or the last slot.
  • A single visually hidden input owns the focus, accepts paste and one-time-code autofill, and is announced with its label. A live region reports how many digits are entered, or that the code was accepted.
  • With prefers-reduced-motion digits appear without rising and the cascade is skipped.