Raft Design System

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.

Stable
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

SituationUse
A part of the large form dialog, listed in its DialogNavFormSection
A part of a form in a drawerFormSection
A form of 2 or 3 fieldsNo 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, in foreground-muted. Required.
  • The status, at the end of the heading row: a soft, muted Badge. Optional.
  • The description, under the heading: text-footnote in foreground-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-hairline between 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 section with an h3 heading. Put it under a dialog or drawer title, which is the level above.
  • Give each section an id when a DialogNav links 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.
PropTypeDefault
descriptionReactNode
statusWhere this part stands (Complete, Optional, Off …): a quiet tag.ReactNode
title (required)ReactNode
renderAllows 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.

Changes