Skip to content
GitHub

Input OTP

Accessible one-time password input component


Installation

Usage

Controlled

Use value and onValueChange to control the input.

Enter the code 1234

State

Disabled

Use the disabled prop to disable the input.

Invalid

Use the invalid prop to mark the input as invalid and show error styling.

Examples

Four Digits

Use four <InputOtpSlot /> elements for a 4-digit OTP.

Separator

Add <InputOtpSeparator /> between groups of slots.



With Placeholder

Use the placeholder prop to show a placeholder in each slot.

Blur on Complete

Use the blurOnComplete prop to blur the input when all slots are filled.

Mask

Use the mask prop to mask the input value.

Custom Size

Pass className to <InputOtp /> to override slot dimensions and text size.

API Reference

InputOtp

InputOtpSlot

Single OTP slot. Use index to specify position (0-based).

InputOtpSeparator

Visual separator between slots. Extends native <hr> props.


For a complete list of props, see the Ark UI documentation.