About
A multi-cell input for typing a short confirmation code or PIN one character per cell, with numeric or text mode, grouping, masking, paste-fill and arrow/backspace navigation.
Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Pin Input to your project and fits it to your theme.
Code
How Pin Input is used: the demo's code. The component's own source comes with a free account.
Usage.tsx
"use client";
import * as React from "react";
import PinInput from "@/components/ui/pin-input";
export default function PinInputFieldDemo() {
const [code, setCode] = React.useState("");
const [wrong, setWrong] = React.useState(false);
function check(value: string) {
setWrong(value !== "123456");
}
return (
<div className="flex flex-col gap-2 rounded-lg bg-[#0b0b0f] p-8">
<label style={{ fontSize: 13, color: "var(--o-text-2)" }}>
Code from the email
</label>
<PinInput
value={code}
group={3}
invalid={wrong}
onValueChange={(next) => {
setCode(next);
setWrong(false);
}}
onComplete={check}
aria-label="Code from the email"
/>
<span
style={{
fontSize: 13,
color: wrong ? "var(--o-danger)" : "var(--o-text-3)",
}}
>
{wrong ? "Not the code we sent. Try again." : "Six digits. Try 123456."}
</span>
</div>
);
}








