# P otp field 2

> Large OTP field

A shadcn/ui block from the [@coss](https://coss.com/ui) registry, listed on [shadcn.exchange](https://shadcn.exchange/r/coss/p-otp-field-2).

- Page, with a live preview: https://shadcn.exchange/r/coss/p-otp-field-2
- Screenshot: https://abzjhwgwpdpz7ua5.public.blob.vercel-storage.com/shots/coss/p-otp-field-2-light-2e4fcd82ccffbd11.png
- Registry item: https://coss.com/ui/r/p-otp-field-2.json
- Categories: otp field, input
- Listed: 2026-10-13, source last changed 2026-10-13

## Install

```bash
npx shadcn@latest add https://coss.com/ui/r/p-otp-field-2.json
```

Run it in a project that has shadcn/ui set up. It adds the files below and installs what they depend on.

## Dependencies

- Registry items: `@coss/otp-field`

## Files

### `registry/default/particles/p-otp-field-2.tsx`

```tsx
import { OTPField, OTPFieldInput } from "@/registry/default/ui/otp-field";

const OTP_LENGTH = 4;

const OTP_SLOT_KEYS = Array.from(
  { length: OTP_LENGTH },
  (_, i) => `otp-slot-${i}`,
);

export default function Particle() {
  return (
    <OTPField aria-label="One-time password" length={OTP_LENGTH} size="lg">
      {OTP_SLOT_KEYS.map((slotKey, index) => (
        <OTPFieldInput
          key={slotKey}
          aria-label={
            index === 0 ? undefined : `Character ${index + 1} of ${OTP_LENGTH}`
          }
        />
      ))}
    </OTPField>
  );
}
```
