042
A six-digit code field with a ring that glides from slot to slot, room to paste the whole code, a small shake when it's wrong and slots that flow together into a “Verified” pill when it's right.
akaotp·verification code·2fa
Run this in any project set up for the shadcn CLI. It copies the Code Entry source into your components folder, so the code is yours to change.
npx shadcn@latest add https://devl.dev/r/code-entry.jsonImport it and render it. Every prop has a typed default, so it works straight away, and you pass your own data when you’re ready.
import { CodeEntry } from "@/components/code-entry";
export default function Page() {
return <CodeEntry />;
}A free React component in the Forms collection, written in TypeScript with Tailwind CSS on coss ui. MIT licensed.
Read from the Code Entry source. Everything is optional unless it says required.
| Prop | Type | Default |
|---|---|---|
| length | number | 6 |
| groupSize | number | 3 |
| onVerify | (code: string) => boolean | Promise<boolean> | — |
| onVerified | (code: string) => void | — |
| label | string | "Verification code" |
| hint | string | "Enter the 6-digit code we sent you." |
| errorMessage | string | "That code didn’t match. Try again." |
| successLabel | string | "Verified" |
| autoFocus | boolean | false |
| className | string | — |