InputOtp

One-time password input.

Use InputOTP to collect a one-time code across multiple slots.

import { InputOTP, InputOTPGroup, InputOTPSlot } from '@tile-ui/react';

export default function InputOtpDemo() {
	return (
		<InputOTP maxLength={6}>
			<InputOTPGroup>

Registry install

pnpm dlx shadcn@latest add @tile-ui/input-otp

Package usage

import { InputOTP } from '@tile-ui/react';
 
<InputOTP maxLength={6} onComplete={(code) => console.log(code)} />

Highlights

  • Numeric, alphanumeric, and text modes
  • Slots and groups
  • Completion callback

Registry dependencies

ItemPurpose
input-otpComponent source and module styles
coreFramework-agnostic logic helpers
stylesShared SCSS tokens and globals

API reference

InputOtp

PropTypeDefault
valuestring
defaultValuestring
maxLengthnumber
disabledboolean
onChange(value: string) => void
onComplete(value: string) => void
mode'numeric' | 'alphanumeric' | 'text'
allowPasteboolean

InputOtpSlot

PropTypeDefault
indexnumber