Input OTP
A one-time code in separate boxes, where each character rises into its box as it is typed or pasted.
Examples
Default
Each digit rises into its box as it is typed, and a whole code can be pasted.
Checked
Check the code in onValueCommit, keep it readOnly while you do, and show a wrong code as the field’s error.
Alphanumeric
For recovery codes, take letters too, and upper-case them in onValueChange as they arrive.
Installation
npx shadcn@latest add https://kinoui.com/r/otp-input.json- Files
lib/refs.tscomponents/kino/separator.tsxlib/reduce-motion.tscomponents/kino/otp-input.tsx- Packages
@ui-sdk/core@ui-sdk/reactclass-variance-authority- Global CSS
- the feels, the density tokens, the shape tokens and the success and warning colours
New to Kino? Installation covers what your project needs first and the @kino namespace.
API reference
OTPInput
Holds the code, in one input laid over the boxes. Other props go to ui-sdk's OTPInput (opens in a new tab).
OTPInputGroup
A run of boxes. Other props go to ui-sdk's OTPInputGroup (opens in a new tab).
OTPInputSlot
One box, showing the character at its index, from 0. Other props go to ui-sdk's OTPInputSlot (opens in a new tab).
OTPInputSeparator
A short line between groups of boxes. Other props go to ui-sdk's OTPInputSeparator (opens in a new tab).
CSS variables
Accessibility
- A screen reader hears one field with the whole code, named by the field’s label; the boxes are drawn for the eye.
- Arrow keys, Home and End move between boxes, Backspace deletes, and a pasted code fills them all.
- The field asks the browser to fill a one-time code from a message.
- While a code is checked, keep it
readOnly, notdisabled, so focus stays in it. - When the system asks for less motion, characters only fade in.
For agents
What an agent reads on this example with snapshot(), and the actions it can call with act().
The Agent bridge page sets up snapshot() and act() in your app.