Input OTP
A one-time-code field with a slot per character.
Installation
bash
shellui-native add input-otp
Platforms: MAUI · Avalonia.
Usage
Basic
-
<ui:InputOtp Length="6" Completed="OnCodeEntered" /><ui:InputOtp Length="6" Completed="OnCodeEntered" />Not available on yet
MAUI and Avalonia
- MAUI uses a hidden entry with the numeric keyboard; Avalonia puts an invisible text box over the slots.
- On Avalonia,
Focus()focuses that text box.
API
| Property | Type | Default | Description |
|---|---|---|---|
Length |
int |
6 |
Number of slots. |
Value |
string |
— | The entered code. Two-way bindable. |
IsNumeric |
bool |
true |
Digits only (numeric keyboard). False allows letters too. |
HasError |
bool |
false |
Shows the destructive border and ring. |
| Event | Arguments | Description |
|---|---|---|
ValueChanged |
string |
User input only: setting Value from code or a binding doesn't raise ValueChanged or Completed. |
Completed |
string |
Raised when every slot is filled. |