Input OTP
View sourcecomponents/input_otp.goDefault#
Input OTP default example rendered by the production Go component.
components.PaintInputOTP(canvas, theme, bounds, components.InputOTPSnapshot{
ID: tree.ID(page, "code"), Label: "Verification code", Value: code,
Slots: 6, GroupSize: 3, HasActiveSlot: true,
ActiveSlot: min(len(code), 5), ShowCaret: true,
})States#
Input OTP states example rendered by the production Go component.
components.PaintInputOTP(canvas, theme, bounds, components.InputOTPSnapshot{
ID: tree.ID(page, "code"), Label: "Verification code", Value: "482901",
Slots: 6, GroupSize: 3, Invalid: true, Focused: true, ShowCaret: true,
HasSelection: true, SelectionStart: 1, SelectionEnd: 3,
HasComposition: true, CompositionStart: 3, CompositionEnd: 5,
ActiveSlot: 0,
})Installation
Copy the recipe into your own project.
go run ./cmd/viva add --out ./components/local input-otpSource-owned usage#
This preview calls the production Go component directly. Stable IDs, values and open state remain owned by the application; the component only paints and declares interaction semantics.
- Read the linked component source for every option and visual decision.
- Use the native command to verify system text, focus, accessibility and platform integration.
- The browser preview validates shared layout and scene behavior, not native performance.
Verification boundary#
The examples cover representative states supported by the current API. They do not imply that every desktop backend has completed hardware validation.
Keyboard
Use Tab to move between controls and Ctrl/⌘ K to search the catalog. Inside a preview, the Go runtime handles keyboard input.