OTP Field
A one-time code in slots of glass. Pasting a code fills every slot.
Installation#
pnpmnpmyarnbun
$ pnpm dlx shadcn@latest add @liquikit/otp-fieldNeeds the @liquikit registry in your components.json. Set it up once.
Usage#
import { OtpField } from "@/components/liquikit/otp-field"<OtpField length={6} aria-label="Verification code" />Examples#
Grouped#
groupSize puts a gap after every few slots.
API Reference#
OtpField
| Prop | Type | Default |
|---|---|---|
theme | "light" | "dark"Light or dark glass. Falls back to the nearest | — |
lens | Partial<LensProfile>Overrides for the lens profile, such as | — |
liquid | numberHow far the glass squashes and stretches as it moves. | — |
length | numberNumber of characters in the code. | 6 |
groupSize | numberPuts a gap after every so many slots, as in | — |
refraction | "interactive" | "always"When the glass bends the page. | "interactive" |
Also takes every prop of Base UI's otp field, plus className and style.