Enter a one-time verification code with paste support.
import { useState } from 'react';
import { InputOTP } from '@vrum/ui';
export default function Demo() {
const [value, setValue] = useState("");
return (
<InputOTP
maxLength={6}
value={value}
disabled={false}
onChange={setValue}
/>
);
}Copy code| Prop | Type | Default | Description |
|---|---|---|---|
maxLength* | number | none | Maximum number of digits. |
value | string | none | Controlled value; connect the callback to application state. |
defaultValue | string | "" | Initial value for an uncontrolled component. |
onChange | ((value: string) => void) | none | Called when the input value changes. |
disabled | boolean | none | Disable user interaction. |
name | string | none | name configuration. |
type | HTMLInputTypeAttribute | none | type configuration. |
defaultChecked | boolean | none | default checked configuration. |
autoFocus | boolean | none | auto focus configuration. |
className | string | none | Additional CSS classes. |
id | string | none | id configuration. |
style | CSSProperties | none | Inline style overrides. |
aria-invalid | boolean | "false" | "true" | "grammar" | "spelling" | none | Indicates the entered value does not conform to the format expected by the application. |
aria-label | string | none | Defines a string value that labels the current element. |
children | ReactNode | none | Content rendered inside the component. |
onFocus | FocusEventHandler<HTMLInputElement> | none | on focus configuration. |
onBlur | FocusEventHandler<HTMLInputElement> | none | on blur configuration. |
onSubmit | SubmitEventHandler<HTMLInputElement> | none | Called when the form is submitted. |
onKeyDown | KeyboardEventHandler<HTMLInputElement> | none | on key down configuration. |
onClick | MouseEventHandler<HTMLInputElement> | none | Called when the control is activated. |
onSelect | ReactEventHandler<HTMLInputElement> | none | on select configuration. |
checked | boolean | none | checked configuration. |
placeholder | string | none | Hint shown when the field is empty. |
readOnly | boolean | none | read only configuration. |
required | boolean | none | required configuration. |