Input OTP

Base UI

A grouped input for one-time verification codes.

1
2
3
4
5
6
ReadyResponsive

Usage

Package export
tsx
"use client"

import {
  InputOTP,
  InputOTPGroup,
  InputOTPSlot,
} from "@jnpll/elements-ui/input-otp"

export function InputOTPDemo() {
  return (
    <InputOTP maxLength={6} defaultValue="123456">
      <InputOTPGroup>
        <InputOTPSlot index={0} />
        <InputOTPSlot index={1} />
        <InputOTPSlot index={2} />
        <InputOTPSlot index={3} />
        <InputOTPSlot index={4} />
        <InputOTPSlot index={5} />
      </InputOTPGroup>
    </InputOTP>
  )
}

export default InputOTPDemo;

Examples

Disabled state
1
2
3
4
5
6

API Reference

PropType / descriptionDefault
disabledboolean

Disables the control.

false
value / defaultValuestring

Controlled or initial input value.

-
classNamestring

Additional classes, merged with the component styles.

-

Composition & accessibility

Import the composition slots shown in the example. Keep labels and descriptions meaningful; interactive primitives provide keyboard and focus behavior. See the source for the complete typed API.