Skip to content
GaudiGaudi Design System home

Search documentation

Search every page, heading and paragraph.

InputOtp

One-time code entry with grouped slots, paste support and completion feedback.

CoreAdvanced Inputs@gaudi/design-system/core/InputOtpView in StorybookSource

Installation

pnpm add github:ahmadassaf/design-system

Import from @gaudi/design-system. Load @gaudi/design-system/global.css once and add transpilePackages: ['@gaudi/design-system'] in Next.js.

import { InputOTP } from '@gaudi/design-system/core/InputOtp';

Copy an example into your project with the shadcn CLI: npx shadcn@latest add https://design.gaudi.site/r/input-otp-code-formats.json.

Usage

import { InputOTP, InputOTPGroup, InputOTPSlot } from '@gaudi/design-system/core/InputOtp';
<InputOTP maxLength={6} aria-label='Verification code' value={code} onChange={setCode}> <InputOTPGroup>{Array.from({ length: 6 }, (_, index) => <InputOTPSlot key={index} index={index} />)}</InputOTPGroup></InputOTP>

Examples

Code formats

Storybook

API

10 props

Accessibility

The underlying input supports keyboard entry and paste. Label the complete code field and announce validation beside it.