Skip to content

Input Otp ​

6-digit code

Loading...

4-digit code

Loading...

<flint-input-otp-group> ​

Visual grouping wrapper for flint-input-otp-slot elements. Renders slots inline with shared borders.

  • Tag: <flint-input-otp-group>
  • Class: FlintInputOtpGroup

Import ​

ts
import '@getufy/flint-ui'; // auto-registers all
// or
import { FlintInputOtpGroup } from '@getufy/flint-ui';

Usage ​

html
<flint-input-otp-group></flint-input-otp-group>

Slots ​

NameDescription
(default)Accepts flint-input-otp-slot elements.

CSS Parts ​

NameDescription
separatorThe separator element.

CSS Custom Properties ​

PropertyDefault
--flint-text-color—
--flint-otp-slot-width40px
--flint-otp-slot-height48px
--flint-otp-slot-font-size1.25rem
--flint-font-family—
--flint-input-bg—
--flint-input-border-color—
--flint-otp-slot-radius6px
--flint-primary-color—
--flint-primary-focus-ring—
--flint-error-color—
--flint-error-focus-ring—
--flint-otp-gap8px

<flint-input-otp-separator> ​

Visual separator between flint-input-otp-group elements. Renders a short horizontal bar.

  • Tag: <flint-input-otp-separator>
  • Class: FlintInputOtpSeparator

Import ​

ts
import '@getufy/flint-ui'; // auto-registers all
// or
import { FlintInputOtpSeparator } from '@getufy/flint-ui';

Usage ​

html
<flint-input-otp-separator></flint-input-otp-separator>

<flint-input-otp-slot> ​

A single character cell in an OTP input. Place inside flint-input-otp-group. State is managed by flint-input-otp.

  • Tag: <flint-input-otp-slot>
  • Class: FlintInputOtpSlot

Import ​

ts
import '@getufy/flint-ui'; // auto-registers all
// or
import { FlintInputOtpSlot } from '@getufy/flint-ui';

Usage ​

html
<flint-input-otp-slot></flint-input-otp-slot>

Properties ​

PropertyAttributeTypeDefaultDescription
indexindexnumber0Zero-based position index of this slot.
charcharstring''Character displayed. Set by the parent flint-input-otp.
activeactivebooleanfalseWhether the cursor is at this position. Set by the parent flint-input-otp.
invalidinvalidbooleanfalseError / invalid state.

<flint-input-otp> ​

Accessible one-time password input with copy/paste support. Manages a hidden native <input> and syncs each flint-input-otp-slot with the appropriate character and active-cursor state.

  • Tag: <flint-input-otp>
  • Class: FlintInputOtp

Import ​

ts
import '@getufy/flint-ui'; // auto-registers all
// or
import { FlintInputOtp } from '@getufy/flint-ui';

Usage ​

html
<flint-input-otp></flint-input-otp>

Properties ​

PropertyAttributeTypeDefaultDescription
valuevaluestring''Current OTP value. Reflects to attribute for external observation.
defaultValuedefault-valuestring''Initial uncontrolled value. Has no effect after the first render.
maxLengthmax-lengthnumber6Total number of character slots.
patternpatternstring''Per-character regex pattern string. Characters failing the test are
disableddisabledbooleanfalseDisables the OTP input.
namenamestring''Form field name used when submitting form data.
requiredrequiredbooleanfalseMarks the OTP input as required for form validation.
labellabelstring'One-time password'Accessible label for the hidden input (used as aria-label).
descriptiondescriptionstring''Optional description text for the hidden input (used as aria-describedby).

Events ​

EventDetailDescription
flint-otp-change&#123; value: string &#125;Fired on every value change. detail: &#123; value: string &#125;.
flint-otp-complete&#123; value: string &#125;Fired when maxLength chars have been entered. detail: &#123; value: string &#125;.

Slots ​

NameDescription
(default)Accepts flint-input-otp-group, flint-input-otp-separator, and flint-input-otp-slot elements.