Component packs › Latch › Slot OTP

Slot OTP

Digits drop into their slots and bounce; paste cascades; a wrong code shakes the row and pops the digits out, a right one closes the gaps so the slots fuse into one pill with a tick.

Slot OTP is an one-time code from Latch, a component pack with 8 components: Form and sign-in components that work like little mechanisms. Price: $2 for the whole pack.

Built with: one real input, SMS autofill, fuse on success.

Code: React and Next.js (TypeScript), Vue 3, plain HTML/CSS/JS, Tailwind CSS v4 and Motion (motion.dev). No npm packages needed. Keyboard accessible, with a reduced-motion version, in dark and light.

Slot OTP props

PropTypeDefaultDescription
lengthnumber6Number of digits (4–8). Default 6.
titlestring
hintstringLine under the title.
verify(code: string) => boolean | Promise<boolean>accepts 428913Check a full code. Return or resolve true when it is right. Default: accepts 428913.
onComplete(code: string) => voidCalled once the code is verified.
theme'dark' | 'light'
autoplaybooleanShowcase mode: types a wrong code, then the right one, until touched.

Methods on the ref

Use it in React

import SlotOtp from './SlotOtp';

<SlotOtp />

The Vue, HTML, Next.js, Tailwind and Motion versions take the same options.

More in Latch

Good for: Form and sign-in components.