OTP input
One cut cell per character of a code, with a blinking caret in the active one.
Component
OTP input belongs to the Fields group in the CyberSpec catalog. It uses @ui-sdk/react/otp-input, @ui-sdk/react/field.
Installation
Use a React 19 project with shadcn configured. Render the installed components inside the Cyber root, and import your global stylesheet in the app entry point.
bunx --bun shadcn@latest add https://www.cyberspec.dev/r/otp-input.json
Example
"use client"
import { OtpInput } from "@/components/ui/otp-input"
export default function OtpInputDemo() {
return (
<>
<OtpInput label="Access code" pattern="alphanumeric" defaultValue="7K4" hint="Six characters, sent to your deck by the Vanta relay." />
<OtpInput label="Vault pin" length={4} defaultValue="0417" error="Pin expired. Request a new one." />
</>
)
}
Install this example
bunx --bun shadcn@latest add https://www.cyberspec.dev/r/otp-input-demo.json