1
A one-time code input that grows out of a button and settles into a verified badge.
npx shadcn@latest add ikislay/pixel-ui/otp-inputimport { OtpInput } from "@/components/ui/otp-input";export default function Demo() {return (<OtpInputonVerify={async (code) => {const res = await fetch("/api/verify", {method: "POST",body: JSON.stringify({ code }),});return res.ok;}}/>);}
1// Loading…
Options you can pass to customize this component.
onVerify(code: string) => boolean | Promise<boolean>Runs once every slot is filled. Return true to show Verified, or false to reject the code. A thrown error counts as false. Without it, every code passes.
lengthnumberHow many digits the code has.
labelstringText of the button shown before the slots open.
classNamestringClasses applied to the root element.