OTP Input — Playground

px
size
State
html.html
<kui-otp-input [(value)]="code" (complete)="verify($event)" />
OTP input events
  • No events yet.
NameTypeDefaultDescription
lengthnumber6Number of cells. Static numeric values are coerced; an invalid or non-positive value uses 1.
size'xs' | 'sm' | 'md' | 'lg' | undefinedundefinedCell size, the same scale as Input. Falls back to defaults.otpInput.size, then the root size, then md.
maskboolean | undefinedundefinedRenders every cell as type="password" (defaults.otpInput.mask, then false).
integerOnlyboolean | undefinedundefinedRestricts input to digits with a numeric mobile keyboard (defaults.otpInput.integerOnly, then true). false accepts letters and digits, uppercased.
autoFocusbooleanfalseFocuses the first cell that can take focus after the first render, and again on every false to true change.
ariaLabelstring | undefinedundefinedAccessible name of the role="group" cell group. Falls back to the otpInput.label message (Verification code).
[(value)]string''Joined characters of every cell, in order. Set by [formField] or [(value)].
disabledbooleanfalseDisables every cell with the native attribute. Set by [formField] or directly.
readonlybooleanfalseMakes every cell read-only and also blocks pasting a new code and the cross-cell Backspace clear.
requiredbooleanfalseMarks the code required: the first cell, which the field label points at, gets the native required state. Also follows a required ancestor kui-field.
loadingbooleanfalseDisables every cell, blurs the code in place and shows a centered Loader without changing the group size.
invalidbooleanfalseMarks every cell invalid. Through [formField] the raw state is gated by touched before it shows.
errorsreadonly ValidationError[][]Current validation errors. Set by [formField].
touchedbooleanfalseWhether the control has been touched. Set by [formField].
(touch)void-Emitted after any cell edit; marks the control touched in the form system.
(complete)string-Emitted once with the completed value when every cell becomes filled. It fires again only after the code became incomplete and was refilled.
focus(options?)(options?: FocusOptions) => void-Moves focus to the first cell that can take focus, so focusBoundControl() works. Does nothing while every cell is disabled.
--kui-otp-gap / -cell-size / -cell-font-size / -loading-blurCSS custom properties-Gap between cells, the square cell size, the digit font size and the loading blur (2px).
KuiOtpInputOptionsinterface-Shape of defaults.otpInput: size, mask and integerOnly.

Inputs verified against @kikita-labs/ui v2.0.0 public typings.