createAutoForm
createAutoForm(
plugin): (__namedParameters) =>Element
Defined in: packages/forms/src/auto-form.tsx:74
Create an AutoForm React component bound to a specific UI FormPlugin.
The returned component introspects a Drizzle table via introspectTable, builds validation via createResolver, and renders fields using the plugin’s components. Supports both create and edit modes, per-field overrides via FieldConfig, column exclusion, and external react-hook-form instances.
Parameters
Section titled “Parameters”plugin
Section titled “plugin”A FormPlugin providing the UI components for rendering.
Returns
Section titled “Returns”A React component (AutoForm) that accepts AutoFormProps.
(
__namedParameters):Element
Parameters
Section titled “Parameters”__namedParameters
Section titled “__namedParameters”AutoFormProps
Returns
Section titled “Returns”Element
Example
Section titled “Example”import { createAutoForm, createFormPlugin } from "@cfast/forms";
const plugin = createFormPlugin({ components: joyComponents });const AutoForm = createAutoForm(plugin);
// Create mode<AutoForm table={posts} mode="create" onSubmit={handleSubmit} />
// Edit mode with field overrides<AutoForm table={posts} mode="edit" data={existingPost} fields={{ title: { label: "Post Title" } }} exclude={["createdAt"]} onSubmit={handleSubmit}/>