ArcaneJaspr Codex
Documentation
ArcaneOtpInput
One-time password input with separate digit fields
Live Demo
4-Digit Code
6-Digit Code

ArcaneOtpInput#

One-time password input with separate digit fields for verification codes.

Basic Usage#

ArcaneOtpInput(
  length: 6,
  onComplete: (code) => verifyCode(code),
)

Properties#

PropertyTypeDefaultDescription
length int 6 Number of digits
onComplete Function(String)? - Called when all digits filled
onChange Function(String)? - Called on any change
valueString?-Initial value
obscure bool false Hide digits like password
size OtpInputSize md Size variant
disabled bool false Disable input
errorString?-Error message
labelString?-Label above input
separatorString?-Separator character
separatorPosition int? - Where to show separator

Variants#

Four Digit#

ArcaneOtpInput.fourDigit(
  onComplete: (code) => verifyPin(code),
)

Six Digit#

ArcaneOtpInput.sixDigit(
  onComplete: (code) => verify2FA(code),
)

With Separator#

ArcaneOtpInput(
  length: 6,
  separator: '-',
  separatorPosition: 3,
  onComplete: (code) => verify(code),
)

Sizes#

ArcaneOtpInput(length: 4, size: OtpInputSize.sm)
ArcaneOtpInput(length: 4, size: OtpInputSize.md)
ArcaneOtpInput(length: 4, size: OtpInputSize.lg)

Features#

  • Auto-advance focus on digit entry
  • Backspace navigates to previous field
  • Paste support fills all fields
  • Arrow key navigation
  • ARIA labels for accessibility