Interface IFieldSchema<TFieldValues>

Interface representing the schema for a form field.

interface IFieldSchema<TFieldValues> {
    autoComplete?: HTMLInputAutoCompleteAttribute;
    defaultValue?: TFieldValues[Path<TFieldValues>];
    description?: string;
    disabled?: boolean;
    displayConditions?: DisplayCondition<TFieldValues>[];
    fieldClassName?: string;
    fieldStyle?: CSSProperties;
    helpText?: string;
    key: Path<TFieldValues>;
    label?: string;
    options?: {
        label: string;
        value: string;
    }[];
    placeholder?: string;
    removeValidationConditions?: ValidationCondition<TFieldValues>[];
    render?: FieldRenderFunction<TFieldValues>;
    type?: "boolean" | HTMLInputTypeAttribute | "select" | "textarea" | "multi-select" | "radio group";
    validations?: ZodType<TFieldValues[Path<TFieldValues>], any, TFieldValues[Path<TFieldValues>]>;
}

Type Parameters

  • TFieldValues extends FieldValues

    The type of field values.

Properties

autoComplete?: HTMLInputAutoCompleteAttribute

AutoComplete attribute for the field.

defaultValue?: TFieldValues[Path<TFieldValues>]

Default value for the field.

description?: string

A brief description of the field's purpose.

disabled?: boolean

Whether the field is disabled.

displayConditions?: DisplayCondition<TFieldValues>[]

Conditions for displaying the field based on other field values.

fieldClassName?: string

CSS class name for the field.

fieldStyle?: CSSProperties

CSS styles for the field.

helpText?: string

Help text providing additional information about the field.

key: Path<TFieldValues>

The key or path for the field within the form values.

label?: string

The label for the field, displayed in the form UI.

options?: {
    label: string;
    value: string;
}[]

Options for select, multi-select, or radio group fields.

Type declaration

  • label: string
  • value: string
placeholder?: string

Placeholder text for the field.

removeValidationConditions?: ValidationCondition<TFieldValues>[]

Conditions for removing validation from the field based on other field values.

Custom render function for the field.

type?: "boolean" | HTMLInputTypeAttribute | "select" | "textarea" | "multi-select" | "radio group"

The type of the field (e.g., text, select, radio group).

validations?: ZodType<TFieldValues[Path<TFieldValues>], any, TFieldValues[Path<TFieldValues>]>

Validation schema for the field using Zod.