Skip to main content

Form

Renders the item-driven fields only - the same field engine as Editor without the placement shell, toolbars, or save bars. Use it when you need a plain form without any extra shell.

Usage

import { Form } from "@svar-ui/react-editor";
PropTypeDefaultDescription
valuesTValues{}Value source, deep-copied into a draft.
itemsIItemConfig[][]Item configuration, same shape as Editor.items.
cssstring""Extra CSS class appended to the form root.
activeBatchstring | nullnullShows only items whose batch matches this value.
focusbooleanfalseFocuses the first enabled input on mount.
autoSavebooleantrueCommits validated changes to the draft immediately.
readonlybooleanfalseRenders all visible items through their read-only renderers.
childrenReactNodeundefinedCustom content rendered above the generated fields.
onChangeTChangeHandlerundefinedFires when an editable field reports a new value.
onSaveTSaveHandlerundefinedFires when pending changes pass validation and save.
onActionTActionResultHandlerundefinedFires on section item actions.
onValidationTValidationHandlerundefinedFires when the validation error object changes.

Form does not use placement, layout, topBar, bottomBar, or hotkeys.

Example

import { Form } from "@svar-ui/react-editor";

<Form items={items} values={values} readonly={true} />