View as Markdown

API reference: @salmonui/inputs/form

FieldRenderPropsinterface

import type { FieldRenderProps } from '@salmonui/inputs/form';
interface FieldRenderProps {
    readonly inputProps: {
        readonly id: string;
        readonly name: string | undefined;
        readonly required: boolean | undefined;
        readonly disabled: boolean | undefined;
        readonly 'aria-describedby': string | undefined;
        readonly 'aria-invalid': true | undefined;
        readonly 'aria-errormessage': string | undefined;
        readonly ref: (el: HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement | null) => void;
        readonly onBlur: () => void;
    };
    readonly errors: readonly string[];
    readonly invalid: boolean;
    readonly validating: boolean;
}

What a custom control receives from Field.

FieldRenderProps members (4)
NameSignatureDescription
inputPropsreadonly inputProps: { readonly id: string; readonly name: string | undefined; readonly required: boolean | undefined; readonly disabled: boolean | undefined; readonly 'aria-describedby': string | undefined; readonly 'aria-invalid': true | undefined; readonly 'aria-errormessage': string | undefined; readonly ref: (el: HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement | null) => void; readonly onBlur: () => void; };

Spread on the native element that carries the value: id, name, ARIA wiring, ref, onBlur.

errorsreadonly errors: readonly string[];
invalidreadonly invalid: boolean;
validatingreadonly validating: boolean;