View as Markdown

API reference: @salmonui/inputs/form-renderer

FormRendererPropsinterface

import type { FormRendererProps } from '@salmonui/inputs/form-renderer';
interface FormRendererProps extends Omit<FormProps, 'onSubmit' | 'children'> {
    readonly schema: FormSchema;
    readonly uiSchema?: FormUiSchema | undefined;
    readonly onSubmit?: ((data: FormRendererData, details: FormRendererSubmitDetails, event: SubmitEvent<HTMLFormElement> | null) => void) | undefined;
    readonly children?: ReactNode;
    readonly size?: FieldSize | undefined;
    readonly localeText?: FormRendererLocaleText | undefined;
}
FormRendererProps members (14, 8 inherited)
NameSignatureDescription
schemareadonly schema: FormSchema;

JSON Schema subset.

uiSchemaoptionalreadonly uiSchema?: FormUiSchema | undefined;

Layout and widget choices.

onSubmitoptionalreadonly onSubmit?: ((data: FormRendererData, details: FormRendererSubmitDetails, event: SubmitEvent<HTMLFormElement> | null) => void) | undefined;

Every submit, valid or not, with the data typed by the schema. The native submit is prevented unless action is set.

childrenoptionalreadonly children?: ReactNode;

Rendered after the fields, before the submit button.

sizeoptionalreadonly size?: FieldSize | undefined;

Metric set of every field and the submit button. Default 'md'.

localeTextoptionalreadonly localeText?: FormRendererLocaleText | undefined;
refoptionalinheritedref?: Ref<HTMLFormElement>;
actionoptionalinheritedaction?: string | ((formData: FormData) => void | Promise<void>);

A URL or a React 19 action (useActionState).

validationBehavioroptionalinheritedvalidationBehavior?: ValidationBehavior;

'native' (default) blocks an invalid submit and focuses the first invalid field; 'aria' marks fields and submits.

validateOnoptionalinheritedvalidateOn?: ValidateOn;

Default validateOn of the fields inside. Default 'blur'.

validationErrorsoptionalinheritedvalidationErrors?: Readonly<Record<string, string | readonly string[] | undefined>>;

Server errors keyed by field name, shown until the field's value changes.

onBeforeValidateoptionalinheritedonBeforeValidate?: ((event: FormValidateEvent) => void);
onValidateoptionalinheritedonValidate?: ((result: FormValidationResult) => void);
requiredMarkoptionalinheritedrequiredMark?: boolean;

Marks the label of every required field inside with a decorative asterisk (@salmonui/inputs/form/styles.css); the requirement itself is announced from required / aria-required. A Field opts out with requiredMark={false}.