Zazz Design Framework
Components

OTP

A one-time password field with character slots over one real input.

A <ui-otp> wraps a real <input class="ui-input ui-otp-input"> carrying standard OTP attributes: autocomplete="one-time-code", inputmode="numeric", pattern, and maxlength. It stamps an aria-hidden rail of character cells behind the input and stretches the input invisibly over the rail. The input remains the source of truth, so SMS autofill, clipboard paste, IME composition, form submission, and :user-invalid styling work natively while the visual cells mirror text entry. Without JavaScript, the element renders as a standard text input.

The code length comes from maxlength. Origin-bound SMS codes (@example.com #123456) autofill directly into the field.

Default

Loading components…

API

AttributeTargetValues
maxlength.ui-otp-inputThe code length (native)
data-otp-groupsui-otpSeparator layout, e.g. 3-3, 2-2-2 (must sum to maxlength)
data-otp-typeui-otpnumeric (default), alpha, alphanumeric, none
data-otp-maskui-otpRender instead of characters
data-otp-auto-submitui-otpSubmit the owning form once when complete
data-otp-completeui-otp (stamped)Present when every cell is filled

On this page