CSS: form-field-group
.instui-form-field-group — A <fieldset> group with a legend, a column or inline layout, and configurable spacing.
Source: form-field-group.css
Accessibility
Renders a native <fieldset> with a <legend>, so the legend text names the whole group for assistive tech.
Usage
css
@import "@pantoken/components/components.css";
@import "@pantoken/components/form-field-group.css";Examples
html
<fieldset class="instui-form-field-group -layout-columns -col-spacing-medium">
<legend>Shipping address</legend>
<label class="instui-form-field">
<span class="label">First name</span>
<span class="controls"><input class="instui-text-input"></span>
</label>
<label class="instui-form-field">
<span class="label">Last name</span>
<span class="controls"><input class="instui-text-input"></span>
</label>
<label class="instui-form-field">
<span class="label">City</span>
<span class="controls"><input class="instui-text-input"></span>
</label>
<label class="instui-form-field">
<span class="label">State</span>
<span class="controls">
<select class="instui-simple-select">
<option>CA</option>
<option>NY</option>
<option>TX</option>
</select>
</span>
</label>
<div class="instui-form-field-messages">
<span class="instui-form-field-message -type-hint">All fields are used for delivery only.</span>
</div>
</fieldset>Structure
text
.instui-form-field-group.-layout-columns.-col-spacing-medium
legend
form-field (component)
form-field-messages (component)flowchart TD
n0[".instui-form-field-group.-layout-columns.-col-spacing-medium"]:::cssdoc-root
n1("legend"):::cssdoc-part
n2(["form-field"]):::cssdoc-component
n3(["form-field-messages"]):::cssdoc-component
n0 --> n1
n0 --> n2
n0 --> n3
click n2 "/api/css/form-field.md"
click n3 "/api/css/form-field-messages.md"
classDef cssdoc-root stroke-width:1px;
classDef cssdoc-part stroke-width:1px;
classDef cssdoc-slot stroke-width:1px;
classDef cssdoc-component stroke-width:1px;
Modifiers
| Modifier | Description |
|---|---|
.-col-spacing-large | Large column gap. |
.-col-spacing-medium | Medium column gap. |
.-col-spacing-none | No column gap. |
.-col-spacing-small | Small column gap. |
.-layout-aligned | Align child fields to a shared grid. |
.-layout-columns | Lay child fields out in columns. |
.-layout-inline | Lay child fields inline, in a row. |
.-required | Mark the group as required. |
.-row-spacing-large | Large row gap. |
.-row-spacing-medium | Medium row gap. |
.-row-spacing-none | No row gap. |
.-row-spacing-small | Small row gap. |
.-v-align-bottom | Bottom-align the fields. |
.-v-align-middle | Middle-align the fields. |
.-v-align-top | Top-align the fields. |
Pseudo-elements
| Pseudo-element | Description |
|---|---|
::after | Renders the decorative required-field asterisk after the legend text when the group is required. |
Conditions
| Type | Query | Description |
|---|---|---|
| supports | (grid-template-columns: subgrid) | — |
Tokens consumed
| Token | Type | Value |
|---|---|---|
--instui-component-form-field-layout-asterisk-color | <color> | light-dark(#CF1F24, #FA917F)LightDark |
--instui-component-form-field-layout-font-family | [ <font-family-name> | <generic-font-family> ]# | Atkinson Hyperlegible Next, "Helvetica Neue", Helvetica, Arial, sans-serif |
--instui-component-form-field-layout-font-size | <length> | 1rem |
--instui-component-form-field-layout-font-weight | <integer> | 400 |
--instui-component-form-field-layout-gap-inputs | <length> | 0.75rem |
--instui-component-form-field-layout-gap-primitives | <length> | 0.5rem |
--instui-component-form-field-layout-line-height | <length> | 1.125rem |
--instui-component-form-field-layout-text-color | <color> | light-dark(#273540, #ffffff)LightDark |
--instui-spacing-space-lg | <length> | 1rem |
--instui-spacing-space-md | <length> | 0.75rem |
--instui-spacing-space-sm | <length> | 0.5rem |
Browser support
- The
-layout-alignedmode uses CSS subgrid behind an@supportsguard; where subgrid is unsupported, the fields fall back to their own stacked layout.
Subcomponents
Related
- form-field — The single field this group repeats.
- radio-input-group — Groups radio inputs under a legend.