Skip to content

CSS: radio ​

.instui-radio — A native radio button and its label.

Sets its own gap between the control and its label; chaining a -gap-* spacing utility modifier overrides that built-in value.

Source: radio.css

Usage ​

css
@import "@pantoken/components/components.css";
@import "@pantoken/components/radio.css";

Examples ​

html
<label class="instui-radio"><input type="radio" name="r" checked> Option A</label>

Modifiers ​

ModifierDescription
.-context-dangerDanger context colour (toggle variant).
.-context-offOff/neutral context colour (toggle variant).
.-context-successSuccess context colour (toggle variant).
.-context-warningWarning context colour (toggle variant).
.-readonlyRead-only state.
.-size-largeLarge. Long-form alias of -size-lg.
.-size-lgLarge.
.-size-smSmall.
.-size-smallSmall. Long-form alias of -size-sm.
.-toggleAlias — maps to .-variant-toggle.
.-variant-toggleRender as a segmented toggle button.

Pseudo-elements ​

Pseudo-elementDescription
::beforeThe filled inner dot shown when checked; on -variant-toggle it is the focus ring drawn just outside the pill.

States ​

StateDescription
:checked—
:disabled—

Custom properties ​

PropertyTypeDefaultDescription
--pantoken-rt-fill<color>—The toggle's selected fill colour; the -context-* modifiers set it.

Conditions ​

TypeQueryDescription
media(prefers-reduced-motion: no-preference)—
media(forced-colors: active)—
media(prefers-reduced-transparency: reduce)—

Accessibility ​

A native <input type="radio"> drives :checked and :disabled; -readonly is styling only, since radios have no native readonly attribute.

Rules (axe-core)Rebrand (light)Rebrand (dark)CanvasCanvas High Contrast
color-contrastWCAG 2.2 1.4.3FailPassPassPass

Rebrand (light): Elements must meet minimum colour contrast ratio thresholds

  • .-context-warning
  • .-context-danger
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, six pieces of text fall below the minimum contrast. The worst is "Warning selected" at 1.67:1 (needs 4.5:1). Softer contrast is fine only while text stays readable.

Rebrand (dark): With prefers-contrast: less, four pieces of text fall below the minimum contrast. The worst is "Disabled unselected" at 3.15:1 (needs 4.5:1). Softer contrast is fine only while text stays readable.

Canvas: With prefers-contrast: less, four pieces of text fall below the minimum contrast. The worst is "Disabled unselected" at 3.02:1 (needs 4.5:1). Softer contrast is fine only while text stays readable.

Canvas High Contrast: All 31 measured pieces of text stay above the minimum. Two other pieces can't be reduced to one colour. "Disabled unselected" 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, six pieces of text fall below the minimum contrast. The worst is "Warning selected" at 1.67:1 (needs 4.5:1).

Rebrand (dark): With prefers-contrast: more, four pieces of text fall below the minimum contrast. The worst is "Disabled unselected" at 3.15:1 (needs 4.5:1).

Canvas: With prefers-contrast: more, four pieces of text fall below the minimum contrast. The worst is "Disabled unselected" at 3.02:1 (needs 4.5:1).

Canvas High Contrast: All 31 measured pieces of text pass with more contrast. Two other pieces can't be reduced to one colour. "Disabled unselected" 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-radio-input-background-color<color>LightDarklight-dark(#ffffff, #171B21)
--instui-component-radio-input-background-disabled-color<color>LightDarklight-dark(#E8EAEC, #334450)
--instui-component-radio-input-background-hover-color<color>LightDarklight-dark(#ffffff, #171B21)
--instui-component-radio-input-background-readonly-color<color>LightDarklight-dark(#C7CACD, #6A7883)
--instui-component-radio-input-border-color<color>LightDarklight-dark(#7E8792, #5F6E7A)
--instui-component-radio-input-border-disabled-color<color>LightDarklight-dark(#C7CACD, #4A5B68)
--instui-component-radio-input-border-hover-color<color>LightDarklight-dark(#273540, #ffffff)
--instui-component-radio-input-border-readonly-color<color>#8D959F
--instui-component-radio-input-border-selected-color<color>LightDarklight-dark(#1C222B, #ffffff)
--instui-component-radio-input-border-width<length>0.0625rem
--instui-component-radio-input-checked-inset-lg<length>0.375rem
--instui-component-radio-input-checked-inset-md<length>0.375rem
--instui-component-radio-input-checked-inset-sm<length>0.375rem
--instui-component-radio-input-control-size-lg<length>1.5rem
--instui-component-radio-input-control-size-md<length>1.5rem
--instui-component-radio-input-control-size-sm<length>1.5rem
--instui-component-radio-input-control-vertical-margin<length>0rem
--instui-component-radio-input-font-family[ <font-family-name> | <generic-font-family> ]#Atkinson Hyperlegible Next, "Helvetica Neue", Helvetica, Arial, sans-serif
--instui-component-radio-input-font-size-lg<length>1.25rem
--instui-component-radio-input-font-size-md<length>1rem
--instui-component-radio-input-font-size-sm<length>0.875rem
--instui-component-radio-input-font-weight<integer>400
--instui-component-radio-input-gap<length>0.5rem
--instui-component-radio-input-label-base-color<color>LightDarklight-dark(#273540, #ffffff)
--instui-component-radio-input-label-disabled-color<color>LightDarklight-dark(#8D959F, #576773)
--instui-component-radio-input-label-hover-color<color>LightDarklight-dark(#273540, #ffffff)
--instui-component-radio-input-label-readonly-color<color>LightDarklight-dark(#273540, #F2F4F5)
--instui-component-radio-input-line-height-lg<length>1.5rem
--instui-component-radio-input-line-height-md<length>1.5rem
--instui-component-radio-input-line-height-sm<length>1.25rem
--instui-component-radio-input-toggle-background-danger<color>LightDarklight-dark(#F0C16C, #8C6400)
--instui-component-radio-input-toggle-background-off<color>#03893D
--instui-component-radio-input-toggle-background-success<color>#03893D
--instui-component-radio-input-toggle-background-warning<color>LightDarklight-dark(#F0C16C, #8C6400)
--instui-component-radio-input-toggle-border-radius<length>0.25rem
--instui-component-radio-input-toggle-handle-text<color>#ffffff
--instui-component-radio-input-toggle-large-font-size<length>1rem
--instui-component-radio-input-toggle-large-height<length>3rem
--instui-component-radio-input-toggle-medium-font-size<length>0.875rem
--instui-component-radio-input-toggle-medium-height<length>2.5rem
--instui-component-radio-input-toggle-small-font-size<length>0.75rem
--instui-component-radio-input-toggle-small-height<length>2rem
--instui-elevation-depth1none | <shadow>#—
--instui-focus-outline-colorauto | <color>—
--instui-focus-outline-styleauto | <outline-line-style>—
--instui-focus-outline-width<line-width>—
  • checkbox — The multi-select counterpart to a single-select radio.
  • radio-input-group — Collects radios into one single-select fieldset.