@resistdesign/voltra
    Preparing search index...

    Type Alias FieldRenderContext<RenderOutput>

    Context passed to field renderers.

    type FieldRenderContext<RenderOutput = unknown> = {
        allowCustomSelection?: boolean;
        arrayItemErrorMap?: ArrayItemErrorMap;
        constraints?: FieldConstraints;
        customType?: string;
        disabled: boolean;
        error?: ErrorDescriptor;
        errors?: ErrorDescriptor[];
        field: TypeInfoField;
        fieldKey: string;
        format?: string;
        label: string;
        onChange: (value: FieldValue) => void;
        onCustomTypeAction?: (payload: CustomTypeActionPayload) => void;
        onRelationAction?: (payload: RelationActionPayload) => void;
        possibleValues?: LiteralValue[];
        renderField: (
            input: {
                arrayItemErrorMap?: ArrayItemErrorMap;
                disabled?: boolean;
                error?: ErrorDescriptor;
                errors?: ErrorDescriptor[];
                field: TypeInfoField;
                fieldKey: string;
                onChange: (value: FieldValue) => void;
                onCustomTypeAction?: (payload: CustomTypeActionPayload) => void;
                onRelationAction?: (payload: RelationActionPayload) => void;
                translateValidationErrorCode?: (error: ErrorDescriptor) => string;
                value: FieldValue | undefined;
            },
        ) => RenderOutput;
        required: boolean;
        translateValidationErrorCode: (error: ErrorDescriptor) => string;
        value: FieldValue | undefined;
    }

    Type Parameters

    • RenderOutput = unknown
    Index

    Properties

    allowCustomSelection?: boolean

    Whether custom entries are allowed for selectable values.

    arrayItemErrorMap?: ArrayItemErrorMap

    Optional per-index errors for array fields.

    constraints?: FieldConstraints

    Optional validation and UI constraints.

    customType?: string

    Optional custom type identifier.

    disabled: boolean

    True when the field UI should be disabled.

    Optional error descriptor to display under the field.

    errors?: ErrorDescriptor[]

    Optional value-level errors for the field.

    Type info describing the field to render.

    fieldKey: string

    Key that identifies the field in the form values.

    format?: string

    Optional format hint for the field.

    label: string

    Display label for the field.

    onChange: (value: FieldValue) => void

    Change handler for the field value.

    onCustomTypeAction?: (payload: CustomTypeActionPayload) => void

    Optional callback for custom type actions.

    onRelationAction?: (payload: RelationActionPayload) => void

    Optional callback for relation actions.

    possibleValues?: LiteralValue[]

    Allowed literal values for the field.

    renderField: (
        input: {
            arrayItemErrorMap?: ArrayItemErrorMap;
            disabled?: boolean;
            error?: ErrorDescriptor;
            errors?: ErrorDescriptor[];
            field: TypeInfoField;
            fieldKey: string;
            onChange: (value: FieldValue) => void;
            onCustomTypeAction?: (payload: CustomTypeActionPayload) => void;
            onRelationAction?: (payload: RelationActionPayload) => void;
            translateValidationErrorCode?: (error: ErrorDescriptor) => string;
            value: FieldValue | undefined;
        },
    ) => RenderOutput

    Render any field with the same dispatch rules as the parent AutoField call.

    required: boolean

    True when the field must be provided.

    translateValidationErrorCode: (error: ErrorDescriptor) => string

    Translate an error descriptor to a user-facing message.

    value: FieldValue | undefined

    Current value for the field.