Input OTP

Pole kodu jednorazowego: jedno prawdziwe pole rysowane jako osobne komórki, więc wklejanie, autouzupełnianie i czytniki ekranu po prostu działają.

Dostępny w
  • Angular: dostępny
  • Vue: dostępny
  • React: dostępny
  • React Native: dostępny

Użycie

We sent a 6-digit code to your email.

Import

ts
import {
  SoneInputOtpComponent,
} from "@surface-one/angular/input-otp";

Dokumentacja API

SoneInputOtpComponentKomponent

shadcn's InputOTP approach: ONE real `<input autocomplete="one-time-code">` lies transparent over the slots, so paste, SMS / password-manager autofill, IME and screen readers all see a normal text field; the slots only draw it. The caret is kept at the end — a code is typed or pasted, then erased.

Selektor
sone-input-otp
Wejścia
NazwaTyp Domyślnie
length

How many characters the code has.

number6
pattern

What ONE character may be: a RegExp or its source (`SONE_OTP_DIGITS`, `SONE_OTP_ALPHANUMERIC`).

RegExp | stringSONE_OTP_DIGITS
groups

Slots per group, a separator between groups — `[3, 3]`. Ignored unless it adds up to `length`.

readonly number[] | nullnull
disabledbooleanfalse
invalidbooleanfalse
ariaLabelstring | nullnull
ariaDescribedby

Extra ids for `aria-describedby` on the real input.

string | nullnull
inputIdstring | nullnull
namestring | nullnull
valuedwukierunkowestring""
Wyjścia
NazwaTyp
complete

Every slot is filled by the user (typed, pasted or autofilled).

string