Input OTP
One-time-code input with slots.
Import
tsx
import { InputOTP } from "@cronus-ui/ui";
bash
npx cronus-ui add input-otp
Examples
.cronus
The same component declared in Cronus. Emitted at build time from the audit fixtures — the kernel renders it as HTML with no React.
default.cronus
app "audit-fixtures" {
port 5176
}
style {
preset aurora
theme dark
}
component InputOtpDefault layout:inline style:input-otp {
aria-label:"One-time passcode"
label "One-time passcode"
}
page "/audit/input-otp/default" type:custom {
use InputOtpDefault
}
API Reference
Generated from the component's exported types.
InputOTPProps
Extends ComponentPropsWithoutRef<typeof OTPInput>
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | — | Render as the child element via Slot. |
children | ReactNode | — | Contents of the component. |
className | string | — | Additional class names merged onto the root. |
maxLength | number | — | — |
value | string | — | Controlled value. |
onChange | (value: string) => void | — | Called when the value changes. |
disabled | boolean | — | Disables pointer and keyboard interaction. |
InputOTPGroupProps
Extends HTMLAttributes<HTMLDivElement>
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Additional class names merged onto the root. |
children | ReactNode | — | Contents of the component. |
id | string | — | DOM id of the root element. |
InputOTPSlotProps
Extends HTMLAttributes<HTMLDivElement>
| Prop | Type | Default | Description |
|---|---|---|---|
index* | number | — | — |
className | string | — | Additional class names merged onto the root. |
children | ReactNode | — | Contents of the component. |
id | string | — | DOM id of the root element. |
InputOTPSeparatorProps
Extends HTMLAttributes<HTMLDivElement>
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Additional class names merged onto the root. |
children | ReactNode | — | Contents of the component. |
id | string | — | DOM id of the root element. |