Skip to content

Animated OTP Input

~8.9 kB

Last updated: November 19, 2026

Animated OTP input for React and shadcn/ui — OTP Slots auto-advances, handles backspace, and animates focus and validation states.

Installation

npx smoothui-cli add otp-slots

Features

  • Auto-advance and backspace support
  • Animated focus and validation
  • Masking options
  • Accessible and mobile-friendly

Accessibility

Keyboard Interactions

KeyDescription
0-9Enters a digit and auto-advances to the next slot
BackspaceDeletes the current digit and moves focus to the previous slot
TabMoves focus to/from the OTP input

ARIA Attributes

AttributeElementPurpose
aria-labelOTP inputProvides an accessible name (defaults to "One-time password input")
aria-describedbyOTP inputReferences an optional description element for additional context

Reduced Motion

This component respects the prefers-reduced-motion media query via useReducedMotion from Motion. When reduced motion is preferred, slot entrance animations, digit flip transitions, and the blinking caret are all disabled.

OTP Slots is a form component with motion already built in. If you are comparing engines rather than components, start with best react animation libraries.

Props

Created by

Powered by

motion.dev
lucide.dev
input-otp.rodz.dev