motionsnack

Animated React sections that already feel finished.

Copy them into Next.js or add them with one command. Plain React and Tailwind, light and dark.

New sections, once a month

One short email when something new lands. No spam.

Library

  • Sections
  • Blocks
  • Components
  • Application UI
  • Templates

Popular

  • Hero
  • Gallery
  • Testimonials
  • Stats
  • Logos
  • FAQ

Resources

  • Installation
  • All components
  • All blocks
  • All sections
  • All application UI
  • Design system
  • Changelog
  • Pricing

Company

  • About
  • Contact
  • Terms
  • Privacy

Install

npx motionsnack add <name>Step-by-step guidehello@motionsnack.dev
Kuba Šťastný@kubastastnydev

© 2026 motionsnack. All rights reserved.

TermsPrivacy

motionsnack

motionsnack
DocsSectionsTemplatesWhat's newPricing
Get lifetime access
  1. Home
  2. Docs
  3. Components
  4. Input
  5. OTP Input
ComponentsBlocksSectionsApplication UI
ComponentsBlocksSectionsApplication UI

Accordion

  • Spring Accordion

Alert

  • Glow Alert

Audio

  • Podcast PlayerNew
  • Voice NoteNew
  • Voice RecorderNew

Avatar

  • Avatar Stack

Badge

  • Pulse Badge

Breadcrumb

  • Slide Breadcrumb

Button

  • Chip ButtonNew
  • Glow Border Button
  • Glow ButtonNew
  • Plain ButtonNew

Calendar

  • Month Calendar

Checkbox

  • Checkbox CardsNew
  • Checkbox GroupNew
  • Chip CheckboxNew

Cropper

  • Image Cropper

Dialog

  • Spring Dialog

Dropdown

  • Command MenuNew
  • Stagger Dropdown
  • Switcher DropdownNew

File Upload

  • Drop Zone Upload

Input

  • Addon InputNew
  • Button InputNew
  • Copy InputNew
  • Date InputNew
  • Floating Label Input
  • Joined InputsNew
  • Notched Label InputNew
  • Number StepperNew
  • OTP InputNew
  • Password InputNew
  • Phone InputNew
  • Range InputNew
  • Search InputNew
  • Tag InputNew
  • Text FieldNew

Loader

  • Curtain LoaderNew
  • Greeting LoaderNew
  • Line LoaderNew
  • Meter LoaderNew
  • Split LoaderNew

Navigation Menu

  • Mobile Tab BarNew

Notification

  • Notification BellNew
  • Toast Stack

Pagination

  • Sliding Pagination

Popover

  • Spring Popover

Radio

  • Card Radio Group
  • Payment MethodNew
  • Radio GroupNew
  • Rating RadioNew

Select

  • ComboboxNew
  • Glide Select
  • Multi SelectNew
  • Rich SelectNew
  • Select FieldNew
  • Tree SelectNew

Sidebar

  • Icon RailNew

Slider

  • Glow Slider

Stepper

  • Progress Stepper

Switch

  • Billing SwitchNew
  • Switch RowNew
  • Toggle SwitchNew

Table

  • Sortable Table

Tabs

  • Sliding Tabs

Textarea

  • Auto Grow Textarea

Toggle

  • Icon ToggleNew
  • Theme ToggleNew
  • Toggle GroupNew

Tooltip

  • Follow Tooltip

Input

OTP Input

New

A one-time code field with a cell per digit, a blinking caret and paste support.

npx motionsnack add otp-input

Customize

px
px
<OtpInput />

Props

24 properties

PropertyTypeDefaultDescription
valuestring-Controlled value. Leave undefined to let the component manage it.
defaultValuestring''Value on first render when uncontrolled.
onChange(value: string) => void-Called with the code on every change.
onComplete(value: string) => void-Called once all cells are filled.
errorColorstringundefinedError colour for both themes. Undefined uses the per-theme pair (#dc2626 light, #ef4444 dark).
lengthLabelstring'{n} digits'Length read after the label to screen readers.
resendLabelstring'Resend code'Text of the resend button.
resendCountdownLabelstring'Resend code in {time}'Resend button text while it counts down.
onResend() => void-Called when the resend button is pressed.
cellSizenumber-Deprecated: use height.
gapnumber-Deprecated: the gap is fixed at 8px.
namestring-Name submitted with a form.
idstringgeneratedId of the input.
classNamestring''Extra classes on the wrapper.
labelstring'Verification code'Label above the cells. Empty hides it.
lengthnumber6Number of characters in the code.
splitbooleantruePut a dash in the middle of the code (even lengths only).
mode'numeric' | 'alphanumeric''numeric'Digits only, or letters and digits.
helperTextstring'We sent a 6-digit code to your e-mail.'Small text under the cells. Empty hides it.
errorstring''Error message. Any text turns the cell borders red and replaces the helper text.
disabledbooleanfalseDisables the field.
showResendbooleanfalseShow a Resend code button with a 30s countdown.
heightnumber48Width and height of one cell (48, or 40 compact).
radiusnumber12Corner radius of a cell.

About OTP Input

OTP Input asks for a verification code from an e-mail or a text message. Each character has its own cell; typed digits pop in and the active cell shows a blinking caret and the library's clear focus outline. Under the cells sits one real input, so pasting a whole code, autofill from a text message and screen readers all work without extra code. A dash can split the code in the middle, the length runs from 2 to 10 and letters can be allowed. When the last cell is filled onComplete fires; an error message turns the cell borders red and shows the message under them.

What's included

  • One cell per character, 2 to 10 long
  • Paste and SMS autofill through one real input
  • Blinking caret and focus outline on the active cell
  • Optional dash in the middle
  • onComplete when the code is full
  • Error state with red borders and a message
  • Light and dark look
Type
Animated React input component
Library
Components · Input
Stack
Next.js, React, Tailwind CSS
Added
2026-11-23
Install
npx motionsnack add otp-input