ErlangFormDocs v1.0.0
Reference

Public API

ErlForm props, low-level components, and runtime exports.

ErlForm

import { ErlForm } from "erlangform";
<ErlForm<Values>
  form={form}
  schema={schema}
  fieldConfig={fieldConfig}
  sectionConfig={sectionConfig}
  fieldComponent={registry}
  wizard={wizard}
  serverErrors={serverErrors}
  onValuesChange={handleValuesChange}
/>

This lists all props; only form and schema are required. Initialize variables as described in their feature guides.

PropType or role
formReactFormExtendedApi from TanStack useForm
schemaz.ZodObject; provides renderer metadata
fieldConfigFieldConfig for presentation and behavior
fieldComponentComponentRegistry for type-based overrides
sectionConfigSectionConfigs keyed by section name
wizardFormWizardOptions for steps
serverErrorsRecord of paths to strings or readonly string arrays
onValuesChangeComplete values callback, including on mount

ErlForm has no children, onSubmit, defaultValues, className, or theme prop in 1.0.0. useForm handles submission and defaults; the application supplies the HTML wrapper. AutoForm is the internal implementation name, not a public component export.

For serverErrors, read the TanStack compatibility note. The demo mirrors errors into errorMap.onServer because the prop alone does not populate derived errors with the installed TanStack version.

Field

A low-level single-field component. Required props: form, name, type, state. Optional props: config, fieldComponent, values. type refers to inferred metadata such as string/number/boolean; password/textarea belong to config.type.

import { Field } from "erlangform";
<Field form={form} name="name" type="string"
  state={{ visible: true, disabled: false, readOnly: false, required: false }}
  config={{ label: "Name" }} />

Field renders the control, label, description, and error. It does not process showIf, clearOnHide, layout, or recursive containers like FieldRenderer does. Supply effective state yourself.

FieldRenderer and infer

Form values

[
  {
    "name": "name",
    "type": "string"
  },
  {
    "name": "active",
    "type": "boolean"
  },
  {
    "name": "email",
    "type": "email"
  }
]

Select a schema to inspect the actual metadata from infer.

Use your form instance from useForm. See the initial setup.

example.tsx
const schema = z.object({
  name: z.string(),
  active: z.boolean(),
});

const fields = infer(schema);

infer accepts z.ZodObject and returns FieldMeta[]. Each entry has name/type, with fields for objects, item for arrays/records, items for tuples, variants/discriminator/variantKeys for unions, and options for string choices. Metadata does not include all validation checks, schema bounds, or default values.

FieldRenderer takes form, field metadata, values, and optional fieldConfig, fieldComponent, parentPath, and legacyFieldConfig. When using it without ErlForm, subscribe to current values yourself, for example through form.Subscribe.

All public imports come from erlangform. FieldArray, FieldControl, FieldSection, AutoFormProps, SelectOption, and internal utilities are not exported. See public types; avoid src/dist subpath imports.

On this page