When to use it
The application verifies codes and owns submission. Normalize localized digit input into ASCII; reject invalid or excess input without truncating. Never send or persist credentials from the component.
Enter numeric verification codes with native paste and autofill integration.
Apple availability
Import LumenUI in the target that uses this component. iPad support follows the iOS package baseline and uses native iPad layout behavior.
Native example
The application verifies codes and owns submission. Normalize localized digit input into ASCII; reject invalid or excess input without truncating. Never send or persist credentials from the component.
import LumenUI
import SwiftUI
struct VerificationCode: View {
@State private var code = ""
var body: some View {
LumenInputOTP("Verification code", text: $code, length: 6,
description: "Enter or paste six digits")
}
}Reference
The primary shared and platform-specific options exposed by LumenInputOTP.
| API | Values or type | Default | Description |
|---|---|---|---|
| _ label / text | String / Binding<String> | Required | Controls at most length ASCII digits; localized edits normalize to ASCII. |
| length | Int | 6 | Accepts code lengths from one through twelve. |
| masked | Bool | false | Hides displayed digits. |
| onComplete | (String) -> Void | Empty closure | Reports a newly completed edit; the host verifies and submits. |
| description / errorMessage | String? | nil | Provides localized supporting copy or host validation. |
| readOnly / .disabled(...) | Bool | false | Blocks editing; disabled state comes from the SwiftUI environment. |
Native behavior
The application verifies codes and owns submission. Normalize localized digit input into ASCII; reject invalid or excess input without truncating. Never send or persist credentials from the component.
Uses one native input for paste, selection, deletion, and SMS code autofill; supports errors and optional masking.
Shared component