Form
A <form> element that stacks its children vertically with a configurable gap. Wrap any combination of form controls to produce consistent vertical rhythm without writing per-page layout CSS.
Usage
When to use
- Any
<form>that submits one or more form controls - Wrapping a stack of form controls that need consistent vertical rhythm
- As the outer element for sign-up, contact, login, and similar flows
When not to use
- Inline filter chips with no submit step - use a plain wrapper or filter
- A single search field in a header bar - use search
- Decorative groupings inside an existing form - use fieldset
Do
- Set
methodandactionso the form still submits without JavaScript - Use the size values (
sm,lg) when the form sits inside a dense surface or a hero - Group related controls inside fieldset for shared semantics
Don't
- Don't wrap controls from multiple unrelated submissions in a single form
- Don't disable native HTML validation unless a custom validator runs in its place
- Don't override the form gap with per-instance margins - use the size values instead
API
Slots
| Slot | Required | Description |
|---|---|---|
content | Yes | HTML string for the inner content of the form. |
Props
| Prop | Type | Default | Description |
|---|---|---|---|
action | string | - | URL where form data is submitted. |
method | Enum: get, post | get | HTTP method. |
enctype | Enum: application/x-www-form-urlencoded, multipart/form-data, text/plain | - | Encoding type for the submitted form data. |
name | string | - | Name of the form. |
target | string | - | Response target: _self, _blank, _parent, _top, or a named browsing context. |
autocomplete | Enum: on, off | - | Controls browser autofill behavior. |
use_novalidate | boolean | - | Skips native HTML validation on submit. |
classes | array | - | Additional CSS class words merged into the root element. |
attributes | object | - | Additional HTML attributes spread on the root element. |
Classes
| Class | Capability | Default | Description |
|---|---|---|---|
.subtle | Emphasis | - | Lower emphasis; a muted, quieter weight. |
.neutral | Emphasis | Yes | Default emphasis; the standard weight at balanced contrast. |
.accent | Emphasis | - | Higher emphasis; a stronger, louder weight. |
.sm | Size | - | Small. |
.md | Size | Yes | Medium. |
.lg | Size | - | Large. |
.fluid | Layout | - | Full-width, no max-width. |
.contained | Layout | Yes | Constrained to a max-width. |
Accessibility
- WCAG 2.2 AA
- Native
<form>semantics so assistive tech recognizes the submission boundary - Each form control inside keeps its own label, helper text, and error association - form does not interfere with control semantics
- Vertical rhythm gap is honored by reduced-motion users (no animation involved)