Example#
Usage#
Use a radio group to pick exactly one option from two to about six, all in view. Every option is visible, so people can compare before they pick.
- Appearance.
list(default) for longer labels,keysfor short ones as toggle keys that wrap into an even grid on phones,cardsfor options with a title, a description and an optional line badge, such as a service tier. - Always a default? Pick one only when it is the safe, common answer; otherwise leave the group empty and mark it required.
- More options than fit, use
Select. To switch a view rather than answer a question, useSegmentedControl.
Anatomy#
- Ring24 px, 2 px rule; selected adds a 10 px dot.
.mk-radio-ring - LabelThe whole row is the target.
.mk-radio-label - DescriptionOptional detail in the meta role.
.mk-radio-description
Volume#
Reading layer: identical at every volume.
Quiet
Studio
Press
Rave
Content#
- The legend asks the question; options answer it in parallel form: "Under $5k", "$5k to $15k", "More".
- Ranges never overlap and never leave a gap.
- Order options logically: small to large, early to late.
Do and don't#
Do
Don't
Accessibility#
- Native radios: Tab enters the group on the checked radio, arrows move and select.
- The selected radio shows a dot on the selected face; selected keys and cards add an ink rule and a check.
| Keys | What happens |
|---|---|
| Tab | Moves into the group, onto the checked radio |
| Arrow keys | Move to the next or previous radio and select it |
| Space | Selects the focused radio |
The colour pairs it prints, with their contrast on both papers:
| Text | Surface | Role | Bone | Night |
|---|---|---|---|---|
--mk-ink-rule | --mk-paper | ui | 3.27:1 · Lc 56.5, passes | 3.65:1 · Lc 25.6, passes |
--mk-ink-rule | --mk-paper-sunken | ui | 3.01:1 · Lc 51.2, passes | 3.49:1 · Lc 25.2, passes |
--mk-ink-rule | --mk-paper-plate | ui | 3.65:1 · Lc 64.1, passes | 3.38:1 · Lc 24.8, passes |
Props#
| Prop | Type | Default | Description |
|---|---|---|---|
label required | ReactNode | none | Required: the visible label. |
description | ReactNode | none | |
className | string | none | Lands on the row (`label.mk-radio`). |
style | CSSProperties | none | Lands on the row. |
Tokens#
System tokens (41)
--mk-border--mk-border-thick--mk-control--mk-control-rule--mk-disabled--mk-dur-press--mk-ease-out--mk-ease-pop--mk-focus--mk-font-text--mk-on-control--mk-on-selected--mk-radius-control--mk-rule--mk-selected--mk-space-1--mk-space-2--mk-space-3--mk-space-4--mk-space-5--mk-space-6--mk-surface-raised--mk-target-min--mk-target-touch--mk-text--mk-text-2--mk-text-disabled--mk-type-body-ui-leading--mk-type-body-ui-size--mk-type-body-ui-tracking--mk-type-body-ui-weight--mk-type-field-label-leading--mk-type-field-label-size--mk-type-field-label-weight--mk-type-meta-leading--mk-type-meta-size--mk-type-meta-weight--mk-type-row-title-leading--mk-type-row-title-size--mk-type-row-title-tracking--mk-type-row-title-weight
Its own properties (2)
--mk-radio-key-edge--mk-radio-ring
Changelog#
Arrived in 0.1.0.
- The reading layer's controls, overlays, forms and visitor prefs (P2-T1 to P2-T5): every Button is the comic hit key, with IconButton, Link and Tooltip; Input, Textarea, Select, Checkbox and CheckboxGroup, Radio and RadioGroup, Switch, Slider with the ruler, RulerReadout and SegmentedControl; Dialog, Drawer, NavSheet, Tabs, Disclosure, Faq and faqJsonLd on Base UI 1.9 where the platform falls short; Field, Fieldset, Form with the site's inline validation, ErrorSummary, Callout, Honeypot, FormTimestamp and QuoteForm; PrefsScript under 1 KB, usePref and setPref with cross-tab sync, ThemeToggle and the visitor VolumeDial; VisuallyHidden.