Form Patterns
Form
A form element wrapper with built-in vertical stack layout and configurable gap spacing. Provides consistent structure for form pages.
Import
import { Form } from "@mikenotthepope/substrateui"Gap Variants
Adjust the gap prop to control vertical spacing between form children. The default value of "xl" works well for most forms with distinct sections.
API Reference
| Prop | Type | Default | Description |
|---|---|---|---|
gap | "none" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "xl" | Vertical spacing between child elements. Uses the Stack component internally for layout. |
onSubmit | (e: React.FormEvent) => void | — | Form submission handler. |
className | string | — | Additional CSS classes to apply to the form element. |
childrenrequired | React.ReactNode | — | Form content, typically Field components, FormSections, and FormActions. |