Skip to content

CSS: radio-input-group ​

.instui-radio-input-group — A single-select radio <fieldset>, plain or as a connected segmented toggle.

Sets its own gap between radios; chaining a -gap-* spacing utility modifier overrides that built-in value.

Source: radio-input-group.css

Usage ​

css
@import "@pantoken/components/components.css";
@import "@pantoken/components/radio-input-group.css";

Examples ​

html
<fieldset class="instui-radio-input-group">
  <legend>T-shirt size</legend>
  <label class="instui-radio"><input type="radio" name="shirt-size" checked> Small</label>
  <label class="instui-radio"><input type="radio" name="shirt-size"> Medium</label>
  <label class="instui-radio"><input type="radio" name="shirt-size"> Large</label>
</fieldset>

Structure ​

text
.instui-radio-input-group.-variant-toggle
  legend
  radio (component)
    input
flowchart TD n0[".instui-radio-input-group.-variant-toggle"]:::cssdoc-root n1("legend"):::cssdoc-part n2(["radio"]):::cssdoc-component n3("input"):::cssdoc-part n0 --> n1 n2 --> n3 n0 --> n2 click n2 "/api/css/radio.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
.-layout-columnsLay the radios out in columns.
.-layout-inlineLay the radios out inline.
.-requiredMark the group as required.
.-variant-toggleLay the child toggles out as a segmented control (only the selected segment fills).

Pseudo-elements ​

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

Accessibility ​

Use a native <fieldset> with a <legend> that names the group. Radios within a group share one name; independent groups need distinct names and legends so selecting one group's radio doesn't clear another group's selection.

ConditionsRebrand (light)Rebrand (dark)CanvasCanvas High Contrast
forced-colors-focus-visibleWCAG 2.2 1.4.11, 2.4.7PassPassPassPass
less-contrast-stays-readableWCAG 2.2 1.4.3FailFailFailReview needed

Rebrand (light): With prefers-contrast: less, one piece of text falls below the minimum contrast. The worst is "Large unavailable" at 2.74:1 (needs 4.5:1). Softer contrast is fine only while text stays readable.

Rebrand (dark): With prefers-contrast: less, one piece of text falls below the minimum contrast. The worst is "Large unavailable" at 3.15:1 (needs 4.5:1). Softer contrast is fine only while text stays readable.

Canvas: With prefers-contrast: less, one piece of text falls below the minimum contrast. The worst is "Large unavailable" at 3.02:1 (needs 4.5:1). Softer contrast is fine only while text stays readable.

Canvas High Contrast: All 13 measured pieces of text stay above the minimum. one other piece can't be reduced to one color. "Large" can't be measured because an element behind it is partly transparent.

more-contrast-respectedWCAG 2.2 1.4.3, 1.4.6FailFailFailReview needed

Rebrand (light): With prefers-contrast: more, one piece of text falls below the minimum contrast. The worst is "Large unavailable" at 2.74:1 (needs 4.5:1).

Rebrand (dark): With prefers-contrast: more, one piece of text falls below the minimum contrast. The worst is "Large unavailable" at 3.15:1 (needs 4.5:1).

Canvas: With prefers-contrast: more, one piece of text falls below the minimum contrast. The worst is "Large unavailable" at 3.02:1 (needs 4.5:1).

Canvas High Contrast: All 13 measured pieces of text pass with more contrast. one other piece can't be reduced to one color. "Large" can't be measured because an element behind it is partly transparent.

reflow-at-320pxWCAG 2.2 1.4.10PassPassPassPass
text-spacing-no-clippingWCAG 2.2 1.4.12PassPassPassPass
Screen reader (simulated)Rebrand (light)Rebrand (dark)CanvasCanvas High Contrast
AnnouncementsPassPassPassPass

These automated results do not establish that the page meets WCAG; manual review is still needed.

Tokens consumed ​

TokenTypeValue
--instui-component-form-field-layout-asterisk-color<color>LightDarklight-dark(#C51F22, #FA917F)
--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>LightDarklight-dark(#273540, #ffffff)
--instui-spacing-space-md<length>0.75rem

Subcomponents ​

  • radio — The individual control this group collects.
  • form-field-group — The general wrapper for grouping and laying out fields.