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 'flint-ui'; // auto-registers all
// or
import { FlintInputOtpGroup } from 'flint-ui';

Usage ​

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

Slots ​

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

CSS Custom Properties ​

PropertyDefault
--flint-text-color#111827
--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 'flint-ui'; // auto-registers all
// or
import { FlintInputOtpSeparator } from '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 'flint-ui'; // auto-registers all
// or
import { FlintInputOtpSlot } from '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> ​

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

Import ​

ts
import 'flint-ui'; // auto-registers all
// or
import { FlintInputOtp } from '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 silently rejected on input and paste. E.g. "\\d" accepts digits only; "[a-zA-Z0-9]" accepts alphanumeric.
disableddisabledbooleanfalseDisables the OTP input.
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{ value: newVal }
flint-otp-complete{ value: newVal }

Slots ​

NameDescription
(default)Default slot for content