GPUI Deck

Input OTP

One numeric editor, native selection/paste/delete/undo, digit slots and completion events.

Rendered by GPUI’s web backend from the real component. Requires a browser with WebGPU.

InputOtpState::new(length, window, cx) creates one retained InputState with a fixed nonzero slot count and an ASCII-digit/length validator. InputOtp paints application-supplied slots through .slot(|slot, window, cx| ...); each slot receives its index, character, active/selected state and disabled/read-only flags. Use those facts for borders, grouping and selection presentation. A slot click selects a position in the same editor, and there is only one input Tab stop and native accessibility owner.

Native paste, selection, arrow navigation, Backspace/Delete and undo remain with the existing editor. The entire resulting pasted value must be numeric and fit; text is not silently truncated or distributed among separate editors. InputOtpEvent reports the edited value and whether all slots are filled. set_value validates programmatic replacement; input() exposes the retained editor for existing Enter/focus integration without changing its validator. Completion is a length condition, and verification remains application-owned.

The catalogue Forms and feedback view uses the local code 742915: completing entry enables Review session, which opens a real confirmation Drawer; confirming closes the modal before pushing a timed Toast onto a Toaster, and a mismatched code also stacks a notification. Editing the code clears the local confirmation state. No remote verification or transport is involved.