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-slotsFeatures
- Auto-advance and backspace support
- Animated focus and validation
- Masking options
- Accessible and mobile-friendly
Accessibility
Keyboard Interactions
| Key | Description |
|---|---|
0-9 | Enters a digit and auto-advances to the next slot |
Backspace | Deletes the current digit and moves focus to the previous slot |
Tab | Moves focus to/from the OTP input |
ARIA Attributes
| Attribute | Element | Purpose |
|---|---|---|
aria-label | OTP input | Provides an accessible name (defaults to "One-time password input") |
aria-describedby | OTP input | References 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.
Related
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
© 2026 SmoothUI. Built by Eduardo Calvo.