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
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. Thedescriptionprop takes only aHelperText, made withhelperText(content, { why, about }), and renders itswhyandaboutasdata-whyanddata-about. Optional. - Its children: the fields (Field), and any action rows.
Behavior
- Fields in a section are 12px apart.
- Sections are
section-gapapart (32px on a phone, 24px on a desktop, half on each side), with aline-hairlinebetween two sections. The first section starts flush with the top of its container, and the last ends flush with its bottom: a section keeps no room outside itself. - The container gives the room around the sections. In the large form dialog that is the sections pane, padded by
--surface-inseton every side, the top included, so the first heading and its status chip sit clear of the header's seam (Forms); in a drawer it is the drawer's body.
Content
- Write the status as one quiet word on where the section stands: Complete, Optional, Off, Private.
- Give a section a description only when it has a consequence its heading doesn't say: what is lost, who sees it, or how to recover ("Shown to everyone who opens the Marketplace",
audience). A line on what the section is for ("Public identity and Marketplace-facing metadata") is cut: the heading says that (Writing › Helper text).
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, when it has a consequence, a helper line, then its fields. Consecutive sections are separated by a hairline.
Also takes the attributes of its element.
Related
Changes
- 0.106.0 · Design SystemA large form dialog's sections pane supplies their inset ([Forms › The large form dialog](https://raft-design.botiverse.build/patterns/forms/#the-large-form-dialog), [FormSection](https://raft-design.botiverse.build/components/form-section/#behavior)): the pane the sections scroll in pads its content by
--surface-inseton every side, the top included, since aFormSectionstarts flush with its container. - 0.103.0 · Breaking ChangesExplanation slots take only a
HelperText:FieldDescription,FormSection'sdescription, aChoiceListitem'sdescription,SelectItemDescription,DialogDescription,AlertDialogDescription,DrawerDescription,PopoverDescription,EmptyStateDescription,CardDescription,CardFooter,BannerDescription,DialogFooterNote(work in progress),MessageActionCardHint,MessageActionCardHeaderDescription,MessageActionCardScopeDescriptionandMessageActionCardActionsNote. AHelperTextis made only byhelperText(content, { why, about }):contentis anyReactNode(a string, a formatted message, aTextLinkinside a sentence),whyis"consequence","audience"or"recovery", andaboutnames the thing the line is about. Each slot renders the content withdata-whyanddata-about, and in development warns once when it is given anything else, which it still renders.ToastDescription,NotificationCenterItemBody,EmptyStateTitle,ListRowDescriptionand the status and data parts are unchanged. - 0.6.0 · Changed
FormSection's first section starts flush with its container.