Skip to content

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>
Shipping address
All fields are used for delivery only.

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

ModifierDescription
.-col-spacing-largeLarge column gap.
.-col-spacing-mediumMedium column gap.
.-col-spacing-noneNo column gap.
.-col-spacing-smallSmall column gap.
.-layout-alignedAlign child fields to a shared grid.
.-layout-columnsLay child fields out in columns.
.-layout-inlineLay child fields inline, in a row.
.-requiredMark the group as required.
.-row-spacing-largeLarge row gap.
.-row-spacing-mediumMedium row gap.
.-row-spacing-noneNo row gap.
.-row-spacing-smallSmall row gap.
.-v-align-bottomBottom-align the fields.
.-v-align-middleMiddle-align the fields.
.-v-align-topTop-align the fields.

Pseudo-elements

Pseudo-elementDescription
::afterRenders the decorative required-field asterisk after the legend text when the group is required.

Conditions

TypeQueryDescription
supports(grid-template-columns: subgrid)

Tokens consumed

TokenTypeValue
--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-aligned mode uses CSS subgrid behind an @supports guard; where subgrid is unsupported, the fields fall back to their own stacked layout.

Subcomponents