FormLayout
FormLayout gives create and edit screens a predictable structure for dense records: validation summary, grouped sections, responsive field grids, and sticky save actions.
Import
import { FormLayout, FormLayoutActions, FormLayoutGrid, FormLayoutSection, FormLayoutSectionDescription, FormLayoutSectionHeader, FormLayoutSectionTitle, FormLayoutValidationSummary,} from '@nim-ui/components';Basic Usage
Edit Order Form
Review these fields
- Customer: Required before release
- Risk level: Review owner must confirm high-risk orders
Order details
Core routing fields used by warehouse and support operators.
Handoff notes
Keep notes operational and specific enough for the next shift.
Visible to operations only.
View Code
<Form onSubmit={handleSubmit}> <FormLayout> <FormLayoutValidationSummary errors={errors} /> <FormLayoutSection aria-labelledby="order-details-heading"> <FormLayoutSectionHeader> <FormLayoutSectionTitle id="order-details-heading">Order details</FormLayoutSectionTitle> <FormLayoutSectionDescription>Core routing fields.</FormLayoutSectionDescription> </FormLayoutSectionHeader> <FormLayoutGrid columns={2}> <FormField label="Customer" name="customer" required> <Input /> </FormField> </FormLayoutGrid> </FormLayoutSection> <FormLayoutActions aria-label="Order form actions"> <Button variant="outline" type="button">Cancel</Button> <Button variant="primary" type="submit">Save changes</Button> </FormLayoutActions> </FormLayout></Form>Props
FormLayout
| Name | Type | Default | Description |
|---|---|---|---|
density | 'comfortable' | 'compact' | 'comfortable' | Controls spacing between form sections. |
className | string | - | Additional classes for page-level form layout. |
FormLayoutGrid
| Name | Type | Default | Description |
|---|---|---|---|
columns | 1 | 2 | 3 | 2 | Responsive field grid. Narrow screens always render one column. |
FormLayoutValidationSummary
| Name | Type | Default | Description |
|---|---|---|---|
errors * | { label: ReactNode; message: ReactNode; href?: string }[] | - | Validation issues rendered inside a polite alert summary. |
title | ReactNode | 'Review these fields' | Summary heading shown above the validation list. |
Backoffice Guidance
- Put record-blocking errors in
FormLayoutValidationSummaryso operators do not hunt field by field. - Use one section per operational concern: identity, fulfillment, billing, permissions, audit notes.
- Keep
FormLayoutActionssticky on long edit pages; usesticky={false}inside modals or drawers.