Skip to content

fix: automatically determine whether number radio field should be vertical or horizontal layout#85

Merged
joshunrau merged 6 commits intomainfrom
radio-group-styles-2
Feb 25, 2026
Merged

fix: automatically determine whether number radio field should be vertical or horizontal layout#85
joshunrau merged 6 commits intomainfrom
radio-group-styles-2

Conversation

@joshunrau
Copy link
Collaborator

@joshunrau joshunrau commented Feb 25, 2026

Summary by CodeRabbit

  • New Features

    • NumberFieldRadio now includes intelligent responsive layout detection that automatically adapts to available space, switching to single-column format when radio options would exceed the viewport width.
  • Refactor

    • BaseRadioField component simplified by removing the orientation configuration property from its public interface.
    • RadioGroup component updated with improved internal code structure, imports, and type system handling.

@coderabbitai
Copy link

coderabbitai bot commented Feb 25, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9418ae9 and 7896f5b.

📒 Files selected for processing (4)
  • src/components/Form/BaseRadioField.tsx
  • src/components/Form/NumberField/NumberFieldRadio.tsx
  • src/components/RadioGroup/RadioGroup.tsx
  • src/components/RadioGroup/RadioGroupItem.tsx

Walkthrough

BaseRadioField eliminates its orientation prop and variant system, simplifying to a standard RadioGroup wrapper. NumberFieldRadio introduces ResizeObserver-based adaptive layout detection to switch between multi-column and single-column rendering. RadioGroup and RadioGroupItem are refactored from forwardRef-wrapped components to functional components with updated Radix UI imports.

Changes

Cohort / File(s) Summary
BaseRadioField Simplification
src/components/Form/BaseRadioField.tsx
Removed orientation prop, cva variant builder, and dynamic option-count-based layout logic. RadioGroup now renders without orientation-dependent styling.
NumberFieldRadio Adaptive Layout
src/components/Form/NumberField/NumberFieldRadio.tsx
Added ResizeObserver to detect overflow and dynamically toggle isColumnLayout state. Replaced className logic with grid-based styling; modified option rendering to conditionally display numeric prefix inline.
RadioGroup Component Refactoring
src/components/RadioGroup/RadioGroup.tsx, src/components/RadioGroup/RadioGroupItem.tsx
Removed forwardRef wrappers and converted to functional components. Updated Radix UI imports to use named Root and Item exports; adjusted type signatures from ComponentPropsWithoutRef to ComponentProps.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~18 minutes

Poem

📻 The Radio Simplifies

Orientation fades, variants rest,
ResizeObserver measures best,
From refs we break, to functions flow,
Grid adapts where options grow. ✨

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch radio-group-styles-2

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@joshunrau joshunrau merged commit 0405cc2 into main Feb 25, 2026
1 of 2 checks passed
@github-actions
Copy link

🎉 This PR is included in version 6.1.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant