animui
ComponentsBlocksDocsPackageTry the demo
Introduction
Installation
Theming
Motion
AI guide
Changelog
Metrics dashboard
KPI drilldown
Metric explorer
Revenue explorer
MRR waterfall
Cohort retention
Usage forecast
Journey flow
Choropleth explorer
Connected scatter
Market terminal
Budget variance
Small multiples
Line replay
AI chat
AI composer
Agent run
AI side panel
SidebarPro4
Page header
Command palette
Notification center
Empty states
Search resultsPro
Login and sign up5
OTP input
Multi-step formPro
Settings page
Settings command
Security settings
Billing overview
Usage billing
Cancel flow
Team members
Invite people
Team directory
Roles and permissions
API keys
Webhooks
Integrations
Environment variables
Plan comparison
Pricing calculatorPro
Usage pricingPro
Cart drawerPro
Checkout summaryPro
Invoice studio
Wallet card
Product listing
Product detail
Inbox triage
Support conversation
Support widget
Help centerNew
File upload
Media playerPro
Week calendar
Availability picker
Project board
Release readiness
Kanban boardNew
Hero section
Hero signupPro
Scroll storyPro
Spotlight gridPro
Feature bentoPro
Comparison table
Logo marquee
Studio perspectivesPro
Stats band
Changelog feed
FAQ section
Contact section
Team showcasePro
Blog grid
Site header
Site footer
CTA section
Newsletter signup
Activity terrain
Revenue globe
Customer galaxy
Semantic zoom
Layout morph
What’s new8 new
BlocksOTP input

OTP input

A six digit verification flow with paste support and keyboard navigation.

npm install https://animui.stracture.net/__local/package.tgz
Pattern · live

When to use

  • Verification codes from email or SMS.
  • Two-factor authentication code entry.

When not to use

  • Use password-field for secrets people type from memory.
  • Use input for any other text.

Installation

Install animui once, then import any component or block from its typed package entry.

animui · 250 components and blocks

React 19 and React DOM 19 are required. The package includes Free and Pro entries, styles and TypeScript declarations.

npm install https://animui.stracture.net/__local/package.tgz

Load the stylesheet once at your app root, then use the typed component import:

import 'animui/styles.css';
import { OtpInput } from 'animui/otp-input';

Read the Code tab for the implementation files and the API reference below for required props.

Download animui 0.3.0 · Agent guide

Usage

Use it as part of verification after you have sent a code. Validate the code on your server.

example.tsx
1import { useState } from "react";2import { OtpInput } from "animui/otp-input";3 4export function VerifyCode() {5  const [code, setCode] = useState("");6  return (7    <OtpInput8      label="Verification code"9      description="We sent a 6-digit code to your email."10      value={code}11      onChange={next => { setCode(next); if (next.length === 6) verify(next); }}12      autoFocus13    />14  );15}
Built fromInputKeyboard navigationValidation

API reference

OtpInput

A row of single-character inputs for one-time codes, with paste fill, a gliding focus ring, and animated helper and error copy.

PropTypeDefaultDescription
labelRequiredstring–Visible label and group name; each slot is labelled with it plus its position.
lengthnumber6Number of slots.
valuestring""Current code. Controlled: update it from onChange.
onChange(value: string) => void–Called with the full code after every edit or paste.
descriptionstring–Helper text below the slots.
errorstring–Error text. Sets aria-invalid and shakes the row once when it changes.
inputMode"numeric" | "text""numeric"numeric strips non-digits.
autoFocusbooleanfalseFocuses the first slot on mount.
disabledbooleanfalseDisables every slot.
classNamestring–Merged onto the field wrapper.

Keyboard interactions

0-9orcharacters
Fills the slot and moves to the next one.
ArrowLeftorArrowRight
Moves between slots.
Backspace
On an empty slot, clears the previous one and moves back.
Delete
Clears the current slot.
Cmd/Ctrl+V
Pastes a code across the slots from the focused one.

Accessibility

  • Slots sit in a labelled role=group, each with an aria-label like Verification code, digit 1 of 6.
  • Helper and error text are linked with aria-describedby; the error uses role=alert and sets aria-invalid.
  • The first slot uses autocomplete one-time-code so browsers can offer SMS codes.

Motion

  • Typed characters rise into the slot and unblur; a paste lands as a short left-to-right wave.
  • One focus ring glides between slots, and a new error nudges the row side to side once.
  • Reduced motion removes the glide, shake, and blur and uses instant fades.

Responsive behavior

  • Slots are 42px wide and can shrink with max-width 100%; below 360px gaps tighten and slots drop to 44px tall.
  • The first slot uses autocomplete one-time-code, so iOS and Android can offer SMS codes.
  • numeric inputMode brings up the number pad on phones.

Performance

  • Only a handful of inputs plus one gliding ring; a ResizeObserver springs the message height.

Notes for AI

Give your coding assistant the Markdown reference instead of screenshots.

  • Use for verification and two-factor codes. Use input or password-field for anything else.
  • It is controlled: keep value in state and submit when value.length equals length. There is no default export, so import it by name.
/components/blocks/otp-input/markdown

The full library index for assistants is at /llms.txt.

Related

InputComponentA single line field with clear labels and useful states.Password fieldComponentCapture sensitive text with a visible reveal control.Login and sign up: Email codeBlockA sign in card that morphs from email to a six digit code to your account.Login and sign up: Sign upBlockAn account creation flow with field validation, password strength, and a clear completion state.Security settingsProBlockAn account security page with guided two-factor setup, password change and active sessions.
PreviousFile uploadNextMulti-step form
animui · 84 block pagesllms.txt

On this page

  • Preview
  • When to use
  • When not to use
  • Installation
  • Usage
  • API reference
  • Keyboard
  • Accessibility
  • Motion
  • Responsive behavior
  • Performance
  • Notes for AI
  • Related
View as Markdown
Verification code
4
8
2
Use the six digit code from your email.Use the six digit code from your email.