API reference: @salmonui/inputs/otp-field
OtpFieldPropsinterface
import type { OtpFieldProps } from '@salmonui/inputs/otp-field';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;
}
| Name | Signature | Description |
|---|---|---|
labeloptionalinherited | label?: ReactNode; | |
descriptionoptionalinherited | description?: ReactNode; | |
errorMessageoptionalinherited | errorMessage?: ((ctx: { readonly errors: readonly string[]; }) => ReactNode) | ReactNode; | Error text (or a function of the errors) shown while the field is invalid. |
lengthoptional | readonly length?: number | undefined; | Number of cells. Default 4. |
typeoptional | readonly type?: 'numeric' | 'alphanumeric' | 'text' | undefined; | Accepted characters: digits (default), letters and digits, or any non-space character. |
maskoptional | readonly mask?: boolean | string | undefined; | Hides the characters (a password input, cells show |
valueoptional | readonly value?: string | undefined; | |
defaultValueoptional | readonly defaultValue?: string | undefined; | |
onValueChangeoptional | readonly onValueChange?: ((value: string, details: OtpChangeDetails) => void) | undefined; | |
onCompleteoptional | readonly onComplete?: ((value: string) => void) | undefined; | Fires when the value reaches |
placeholderoptional | readonly placeholder?: string | undefined; | One character repeated in every empty cell, or one character per cell. |
separatoroptional | readonly separator?: ReactNode; | Drawn between groups. |
groupSizeoptional | readonly groupSize?: number | undefined; | Cells per group; default 1 with a |
transformoptional | readonly transform?: 'uppercase' | 'lowercase' | 'none' | undefined; | Normalizes letters. Default |
localeTextoptional | readonly localeText?: OtpFieldLocaleText | undefined; | |
classNameoptional | readonly className?: string | undefined; | |
styleoptional | readonly style?: CSSProperties | undefined; | |
classNamesoptional | readonly classNames?: {
readonly cells?: string;
readonly cell?: string;
readonly input?: string;
readonly label?: string;
readonly description?: string;
readonly error?: string;
} | undefined; | Part classes: |
refoptional | readonly ref?: Ref<HTMLInputElement> | undefined; | The native |
invalidoptionalinherited | invalid?: boolean; | Forces the error state. |
validationoptionalinherited | validation?: FieldValidation; | Rules in the Data Grid vocabulary. |
validateOnoptionalinherited | validateOn?: ValidateOn; | When errors appear; default the |
sizeoptionalinherited | size?: FieldSize; | Metric set. Default |