ErlangFormDocs v1.0.0
Configuration

Field Section

Group root fields and configure collapsible sections.

Account information

Your account username and email.

Profile

This section can be expanded and collapsed.

A section groups fields visually, for example account information and profile details. Set section on each root field in fieldConfig, then configure the group through the same key in sectionConfig. Try opening and closing the Profile section above.

Usage

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

example.tsx
const schema = z.object({ username: z.string(), email: z.email() });

<ErlForm
  form={form}
  schema={schema}
  fieldConfig={{
    username: { section: "account" },
    email: { section: "account" },
  }}
  sectionConfig={{
    account: { title: "Account", collapsible: true, defaultOpen: true },
  }}
/>

Matching keys

PartExampleRole
Schema fieldusername, emailData and validation
fieldConfig.username.sectionaccountAssign a root field to a group
sectionConfig.accounttitle: "Account information"Configure that group

Section names are arbitrary, but the field section value and sectionConfig key must match. Defining a sectionConfig title alone does not assign fields to that section.

Section options

OptionPurpose
titleGroup heading
descriptionHelp text below the heading
collapsibleUse native details/summary for expansion
defaultOpenInitial state of a collapsible section
classNameSection wrapper class
headerClassNameHeader class
contentClassNameContent wrapper class

Sections only affect presentation. Submitted values still follow the schema: account/profile group names do not create objects. Section grouping happens at the root; a section option on a nested child does not create another section in 1.0.0.

On this page