DocsComponentsTemplatesThemesGitHub

InputOTP

One-time code: N boxes, auto-advance, paste fills all, onComplete when full.

Code

import * as React from 'react';
import { InputOTP } from '@fruit-labs/design';

export default function Demo() {
  return <InputOTP defaultValue="482" separatorAt={3} />;
}

Install

From npm:

npm install @fruit-labs/design

import { InputOTP } from '@fruit-labs/design';

Or copy the TypeScript source into your project:

npx shadcn@latest add https://design.fruitlabs.online/r/input-otp.json

Guidelines

  • 6 digits default; separatorAt={3} splits 3–3.

Props

PropTypeRequired
lengthnumberNo
valuestringNo
defaultValuestringNo
onChange(code: string) => voidNo
onComplete(code: string) => voidNo
alphanumericbooleanNo
separatorAtnumberNo
errorbooleanNo
disabledbooleanNo
labelstringNo
classNamestringNo

Edit this example on GitHub