# OtpFieldProps (@salmonui/inputs/otp-field)

> The OtpFieldProps interface of @salmonui/inputs/otp-field.

Canonical: https://salmonui.dev/docs/reference/inputs/otp-field/OtpFieldProps

```ts
import type { OtpFieldProps } from '@salmonui/inputs/otp-field';
```

Entry index: https://salmonui.dev/docs/reference/inputs/otp-field (Markdown with every symbol of the entry: https://salmonui.dev/docs/reference/inputs/otp-field.md).

## Reference

Kind: interface

```ts
interface OtpFieldProps extends FieldCommonProps, NativeInput {
    readonly length?: number | undefined;
    readonly type?: 'numeric' | 'alphanumeric' | 'text' | undefined;
    readonly mask?: boolean | string | undefined;
    readonly value?: string | undefined;
    readonly defaultValue?: string | undefined;
    readonly onValueChange?: ((value: string, details: OtpChangeDetails) => void) | undefined;
    readonly onComplete?: ((value: string) => void) | undefined;
    readonly placeholder?: string | undefined;
    readonly separator?: ReactNode;
    readonly groupSize?: number | undefined;
    readonly transform?: 'uppercase' | 'lowercase' | 'none' | undefined;
    readonly localeText?: OtpFieldLocaleText | undefined;
    readonly className?: string | undefined;
    readonly style?: CSSProperties | undefined;
    readonly classNames?: {
        readonly cells?: string;
        readonly cell?: string;
        readonly input?: string;
        readonly label?: string;
        readonly description?: string;
        readonly error?: string;
    } | undefined;
    readonly ref?: Ref<HTMLInputElement> | undefined;
}
```

Members (23):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `label` | `label?: ReactNode;` | optional, inherited |  |
| `description` | `description?: ReactNode;` | optional, inherited |  |
| `errorMessage` | `errorMessage?: ((ctx: { readonly errors: readonly string[]; }) => ReactNode) \| ReactNode;` | optional, inherited | Error text (or a function of the errors) shown while the field is invalid. |
| `length` | `readonly length?: number \| undefined;` | optional | Number of cells. Default 4. |
| `type` | `readonly type?: 'numeric' \| 'alphanumeric' \| 'text' \| undefined;` | optional | Accepted characters: digits (default), letters and digits, or any non-space character. |
| `mask` | `readonly mask?: boolean \| string \| undefined;` | optional | Hides the characters (a password input, cells show `•` or the given character). |
| `value` | `readonly value?: string \| undefined;` | optional |  |
| `defaultValue` | `readonly defaultValue?: string \| undefined;` | optional |  |
| `onValueChange` | `readonly onValueChange?: ((value: string, details: OtpChangeDetails) => void) \| undefined;` | optional |  |
| `onComplete` | `readonly onComplete?: ((value: string) => void) \| undefined;` | optional | Fires when the value reaches `length`. |
| `placeholder` | `readonly placeholder?: string \| undefined;` | optional | One character repeated in every empty cell, or one character per cell. |
| `separator` | `readonly separator?: ReactNode;` | optional | Drawn between groups. |
| `groupSize` | `readonly groupSize?: number \| undefined;` | optional | Cells per group; default 1 with a `separator`, else no groups. |
| `transform` | `readonly transform?: 'uppercase' \| 'lowercase' \| 'none' \| undefined;` | optional | Normalizes letters. Default `'none'`. |
| `localeText` | `readonly localeText?: OtpFieldLocaleText \| undefined;` | optional |  |
| `className` | `readonly className?: string \| undefined;` | optional |  |
| `style` | `readonly style?: CSSProperties \| undefined;` | optional |  |
| `classNames` | `readonly classNames?: {     readonly cells?: string;     readonly cell?: string;     readonly input?: string;     readonly label?: string;     readonly description?: string;     readonly error?: string; } \| undefined;` | optional | Part classes: `root` is `className`; `cells`, `cell`, `input`, `label`, `description`, `error`. |
| `ref` | `readonly ref?: Ref<HTMLInputElement> \| undefined;` | optional | The native `<input>`. |
| `invalid` | `invalid?: boolean;` | optional, inherited | Forces the error state. |
| `validation` | `validation?: FieldValidation;` | optional, inherited | Rules in the Data Grid vocabulary. |
| `validateOn` | `validateOn?: ValidateOn;` | optional, inherited | When errors appear; default the `Form`'s, else `'blur'`. |
| `size` | `size?: FieldSize;` | optional, inherited | Metric set. Default `'md'`. |
