Six digits
Type or paste digits into a single native input, visually split into six slots.
length={6}
WelkUI!REACT EDITIONExplore live variants, compare states, and learn every prop. Pick a component to start.
One native numeric-text input visually split into digit slots, preserving paste, autofill, keyboard editing, forms, and reset behavior. User-entered non-digits are removed and input is limited to length. Supplied value/defaultValue must contain only digits and fit the configured length, otherwise a RangeError is thrown. onComplete fires when an edit fills all slots; it does not submit or verify the code.
import { WelkOTPInput } from "@welkui/react";
<WelkOTPInput label="Verification code" length={6}
onComplete={(code) => console.log(code)} />Import @welkui/react/styles.css once in your app. Stateful snippets belong inside a React component.
These are real components, not screenshots. Compare their appearance and try the controls. Key props below each preview show what changes; use the usage example above for imports and component setup.
Type or paste digits into a single native input, visually split into six slots.
length={6}Adjust the expected digit count to match your verification flow.
length={4}The output reflects onValueChange as you type. This is not a real verification service.
value={code} onValueChange={setCode}Displays a code without accepting input.
disabled defaultValue="123456"Required props are marked in the default column. Other props are optional. ReactNode accepts text or JSX.
| Prop | Type | Default | Description |
|---|---|---|---|
label | ReactNode | Required | Visible, accessible control label. |
length | number | 6 | Positive whole-number digit count. |
value | string | Uncontrolled | Controlled selection. Update it in onValueChange. |
defaultValue | string | "" | Initial value for uncontrolled use. |
onValueChange | (value: string) => void | Unset | Called with the updated value; an empty string clears it. |
onComplete | (value: string) => void | Unset | Called when a user edit produces a complete code. |
autoComplete | string | "one-time-code" | Native autofill hint. |
Inherits native input props except the fields replaced by this component's API: name, id, disabled, required, form, onBlur, onFocus, className, style, aria-* and data-* are supported. Forwards an input ref. type, children, onChange, size, maxLength, minLength, pattern and inputMode are managed internally; use onValueChange.
Import @welkui/react/styles.css once in your app entry or Next.js root layout. The previews use the default theme; override --welk-* CSS tokens in your app to customize it.
For Next.js, put hooks and event handlers in a component beginning with "use client". Keep state local to the component using the control. The library preserves its client boundaries and uses your installed React version.
Use defaultValue or defaultChecked for uncontrolled fields, or a state value and its change callback for controlled fields. Do not switch between these modes during the lifetime of a field.
Modal and notification examples start closed: use their Try buttons to see them. Disabled examples are deliberately non-interactive. Validate forms, uploads, authentication, and server responses in your application; these components only provide UI.