Skip to content

feat(react-radio): expose base state hooks for Radio components#35894

Open
dmytrokirpa wants to merge 3 commits intomicrosoft:masterfrom
dmytrokirpa:feat/base-state-hooks-for-radio
Open

feat(react-radio): expose base state hooks for Radio components#35894
dmytrokirpa wants to merge 3 commits intomicrosoft:masterfrom
dmytrokirpa:feat/base-state-hooks-for-radio

Conversation

@dmytrokirpa
Copy link
Contributor

@dmytrokirpa dmytrokirpa commented Mar 24, 2026

This pull request introduces a new set of "base" state hooks and types for the Radio and RadioGroup components in @fluentui/react-radio. These changes make it easier for consumers to access and work with the core state logic of these components, separate from design-specific properties like layout. The update also includes the necessary exports and type definitions to support these new hooks and types throughout the package.

API Additions and Exports:

  • Added RadioBaseProps and RadioBaseState types, and useRadioBase_unstable hook for the Radio component, allowing consumers to work with the base state logic independent of design-specific properties. [1] [2] [3] [4] [5] [6] [7] [8]
  • Added RadioGroupBaseProps and RadioGroupBaseState types, and useRadioGroupBase_unstable hook for the RadioGroup component, similarly exposing the base state logic. [1] [2] [3] [4] [5] [6] [7] [8]
  • Updated renderRadio_unstable and renderRadioGroup_unstable to accept the new base state types, aligning rendering logic with the new state separation. [1] [2]

Refactoring and Internal Consistency:

  • Refactored the useRadio_unstable and useRadioGroup_unstable hooks to delegate to their base counterparts, then add design-specific properties (like layout or label rendering) as needed. [1] [2]
  • Updated exports in all relevant files to ensure the new types and hooks are available throughout the package API. [1] [2] [3] [4] [5] [6]

These changes provide greater flexibility and composability for consumers who need to build custom radio or radio group components on top of Fluent UI's core logic.

@dmytrokirpa dmytrokirpa force-pushed the feat/base-state-hooks-for-radio branch from 3ee2f22 to 9ea7805 Compare March 24, 2026 11:39
@github-actions
Copy link

github-actions bot commented Mar 24, 2026

📊 Bundle size report

Package & Exports Baseline (minified/GZIP) PR Change
react-components
react-components: entire library
1.297 MB
323.993 kB
1.297 MB
324.07 kB
181 B
77 B
react-radio
Radio
30.905 kB
9.611 kB
31.036 kB
9.638 kB
131 B
27 B
react-radio
RadioGroup
13.994 kB
5.688 kB
14.035 kB
5.7 kB
41 B
12 B
react-table
DataGrid
159.346 kB
44.935 kB
159.481 kB
44.953 kB
135 B
18 B
react-table
Table as DataGrid
130.566 kB
35.939 kB
130.702 kB
35.962 kB
136 B
23 B
react-table
Table (Selection only)
68.954 kB
19.303 kB
69.089 kB
19.325 kB
135 B
22 B
react-table
Table (Sort only)
67.597 kB
18.923 kB
67.732 kB
18.942 kB
135 B
19 B
react-tree
FlatTree
147.668 kB
42.127 kB
147.803 kB
42.147 kB
135 B
20 B
react-tree
PersonaFlatTree
149.496 kB
42.513 kB
149.631 kB
42.53 kB
135 B
17 B
react-tree
PersonaTree
145.556 kB
41.337 kB
145.691 kB
41.358 kB
135 B
21 B
react-tree
Tree
143.734 kB
40.964 kB
143.869 kB
40.986 kB
135 B
22 B
Unchanged fixtures
Package & Exports Size (minified/GZIP)
react-components
react-components: Button, FluentProvider & webLightTheme
70.397 kB
19.96 kB
react-components
react-components: Accordion, Button, FluentProvider, Image, Menu, Popover
236.65 kB
68.725 kB
react-components
react-components: FluentProvider & webLightTheme
43.612 kB
14.022 kB
react-portal-compat
PortalCompatProvider
8.386 kB
2.624 kB
react-table
Table (Primitives only)
40.997 kB
13.172 kB
react-timepicker-compat
TimePicker
108.174 kB
35.695 kB
🤖 This report was generated against d2d48440be57395a523dfd901621d99b58340ef4

@github-actions
Copy link

Pull request demo site: URL

@dmytrokirpa dmytrokirpa marked this pull request as ready for review March 25, 2026 14:52
@dmytrokirpa dmytrokirpa requested a review from a team as a code owner March 25, 2026 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant