feat(radio, checkbox, switch): add composable Legend sub-component for group components#423
Conversation
…r group components Add Radio.Legend, Checkbox.Legend, and Switch.Legend sub-components that accept className for full styling control (e.g. sr-only to visually hide). Make legend string prop optional when using the sub-component instead. This solves the problem of redundant visible legends when a group is already labeled by a parent Field or heading. Includes docs demos and API reference entries for all three components.
Switch.Group now matches Radio.Group and Checkbox.Group styling: no border, no padding, no rounded corners. Also normalizes legend from text-lg to text-base.
commit: |
Docs PreviewCommit: |
|
/bonk |
|
Based on my thorough review of PR #423, here's my analysis: Review SummaryThis PR adds composable ✅ What's Well Done
🔍 Minor Observations
🧪 Test Results
💡 Optional EnhancementConsider adding a development warning if neither Overall: This is a well-designed, well-implemented feature that follows all project conventions. The API is intuitive and solves a real problem. I recommend approving this PR. |
…component RadioLegend, CheckboxLegend, SwitchLegend are only accessible as Radio.Legend, Checkbox.Legend, Switch.Legend — no standalone named exports. Type exports (RadioLegendProps, etc.) are still available.
|
/bonk can you please approve? |
|
Based on my thorough review of PR #423, here's my analysis: Review SummaryThis PR adds composable ✅ What's Well Done
🔍 Minor Observations
🧪 Test Results
💡 Optional EnhancementConsider adding a development warning if neither Overall: This is a well-designed, well-implemented feature that follows all project conventions. The API is intuitive and solves a real problem. I recommend approving this PR. |
















































Summary
Radio.Legend,Checkbox.Legend, andSwitch.Legendsub-components that acceptclassNamefor full styling controllegendstring prop optional when using the sub-component insteadFieldor heading (e.g.className="sr-only"to visually hide)Before
When a
RadioGroup(orCheckboxGroup/SwitchGroup) was nested inside aField, the legend created an unavoidable visual duplicate of the label with no way to hide it without targeting internal implementation details.After
Changes
radio.tsx,checkbox.tsx,switch.tsxLegendsub-component, madelegendprop optional*/index.ts,src/index.tsRadioDemo.tsxRadioLegendSrOnlyDemo,RadioLegendCustomDemoCheckboxDemo.tsxCheckboxLegendSrOnlyDemo,CheckboxLegendCustomDemoSwitchDemo.tsxSwitchGroupDemo,SwitchLegendSrOnlyDemo,SwitchLegendCustomDemoradio.mdx,checkbox.mdx,switch.mdx