feat(RadioGroup): add single-choice control (17th atom, D22)#155
Merged
Conversation
RadioGroup + RadioGroupItem is the shadcn "RadioGroup" contract over Base UI's RadioGroup + Radio — role="radiogroup"/role="radio", arrow-key navigation, single selection, hidden form input, shared Button/Input/Checkbox/Switch focus ring. Completes the boolean/choice form-control family: Checkbox -> Switch -> Radio. - Compound (group + item), unlike the self-contained Checkbox/Switch: the selection semantics (single choice, arrow nav, submitted value, name) live on the group, matching shadcn + ARIA APG. shadcn naming (RadioGroupItem, not Radio); data-pharos-slot radio-group / radio-group-item. - Shared form-control conventions: label-less (Escuela 1, D11), no size axis. Error is a group concern -> aria-invalid on the group, every item shows the ring (.group[aria-invalid] .item), not per-control. - Ring-with-dot look, token-derived: circular 20px (spacing-5) control, ring darkens to neutral-900 on select (family "active" color) + inner dot (spacing-2). Dot is a span (Base UI mounts Indicator only when checked), no icon dep. - Stories (Default + WithDisabledItem + Disabled + Invalid), unit tests (9), NAMING-decisions D22, changeset minor. - Harness (rule #8): Settings form gains a "Theme" radio group (light/dark/system); settings.spec picks + enforces single selection + arrow nav -- 26 e2e specs. Verified: build + dist-types, typecheck, lint, unit (RadioGroup 9/9, 214 total), test:storybook a11y (106 stories, +4), build-storybook, e2e 26/26. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AgnovjGivnndpV7Yzt6AmY
|
Tip All tests passed and all changes approved!🟢 UI Tests: 4 visual and accessibility changes accepted as baselines |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
RadioGroup+RadioGroupItem, the 17th Pharos atom — a set of mutually exclusive options (the shadcn RadioGroup contract) over Base UI'sRadioGroup+Radio. It completes the boolean/choice form-control family: Checkbox (D20) → Switch (D21) → Radio.Design (D22)
RadioGroup+RadioGroupItem), unlike the self-contained Checkbox/Switch: the selection semantics (single choice, arrow-key navigation, submitted value,name) live on the group, matching shadcn and the ARIA APG radiogroup pattern.RadioGroupItem(not Base UI'sRadio).data-pharos-slot=radio-group/radio-group-item.<label>/aria-labelledbyand each item with<label htmlFor>; nosizeaxis in v1.aria-invalidgoes on theRadioGroupand every item shows the error ring (.group[aria-invalid] .item), not per-control.spacing-5) control; the ring darkens toneutral-900on selection (the family "active" color) and an inner dot (spacing-2) appears — deliberately distinct from Checkbox's filled square. The dot is a<span>(Base UI mounts the Indicator only while selected) — no icon dependency.Changes
src/components/RadioGroup.{tsx,module.css,stories.tsx}+tests/RadioGroup.test.tsx(9 unit tests).src/index.ts; D22 entry inNAMING-decisions.md; minor changeset.settings.spec.tspicks a value, asserts single-selection, and exercises arrow-key navigation.Verification (all local, green)
pnpm build(+verify:dist-types),pnpm typecheck,pnpm lintpnpm test— 214/214 (RadioGroup 9/9)pnpm test:storybook(axe a11y) — 106/106 (+4 RadioGroup stories)pnpm build-storybookpnpm --filter @examples/saas-demo test:e2e— 26/26 (incl.picks a single theme in the radio group)Notes
Select 'closes on Escape…'flake is pre-existing (green in CI) — unrelated.🤖 Generated with Claude Code
https://claude.ai/code/session_01AgnovjGivnndpV7Yzt6AmY