Components · Layout
FormSection
One part of a large form, with a small heading, a quiet status chip, a line on what the part is for, and its fields, used in the wide dialog and in drawer forms.
import { FormSection } from "@botiverse/raft-ui";A form section is one part of a large form: a small heading, an optional status chip, one line on what the part is for, then its fields. A large form is a stack of them, in the wide Dialog or in a Drawer; the two use the same section.
When to use
| Situation | Use |
|---|---|
A part of the large form dialog, listed in its DialogNav | FormSection |
| A part of a form in a drawer | FormSection |
| A form of 2 or 3 fields | No sections: put the fields in the body of the Dialog |
How the large form dialog is built around its sections is in Forms.
Anatomy
FormSection is one part. It renders, in order:
- The heading:
text-footnote, bold, inforeground-muted. Required. - The status, at the end of the heading row: a soft, muted Badge. Optional.
- The description, under the heading:
text-footnoteinforeground-hint. Optional. - Its children: the fields (Field), and any action rows.
Behavior
- Fields in a section are 12px apart.
- Sections are 16px apart, with a
line-hairlinebetween two sections. The first section starts flush with the top of the body.
Content
- Write the status as one quiet word on where the section stands: Complete, Optional, Off, Private.
- Write the description as one line on what the section is for: "Public identity and Marketplace-facing metadata."
Accessibility
- FormSection renders a
sectionwith anh3heading. Put it under a dialog or drawer title, which is the level above. - Give each section an
idwhen aDialogNavlinks to it, so the section list can jump there.
Rules
- Write actions inside a section as ordinary rows, and show only the sections that can be filled in before an item is saved, as in Forms.
API
FormSection
One part of a bigger form (a wide dialog or sheet): a small heading with its status and a line on what it is for, then its fields. Consecutive sections are separated by a hairline.
| Prop | Type | Default |
|---|---|---|
| ReactNode | ||
| Where this part stands (Complete, Optional, Off …): a quiet tag. | ReactNode | |
| ReactNode | ||
| Allows you to replace the component's HTML element with a different tag, or compose it with another component. | ReactElement | ((props, state) => ReactElement) |
Also takes the attributes of its element.
Related
Changes
- 0.6.0 · Changed
FormSection's first section starts flush with its container.