Skip to content

[form controls] Add internal useFormControlState hook#48344

Merged
mj12albert merged 3 commits into
mui:masterfrom
mj12albert:form-control-state-hook
May 5, 2026
Merged

[form controls] Add internal useFormControlState hook#48344
mj12albert merged 3 commits into
mui:masterfrom
mj12albert:form-control-state-hook

Conversation

@mj12albert
Copy link
Copy Markdown
Member

Closes #39286

@mj12albert mj12albert added the internal Behind-the-scenes enhancement. Formerly called “core”. label Apr 21, 2026
@code-infra-dashboard
Copy link
Copy Markdown

code-infra-dashboard Bot commented Apr 21, 2026

Deploy preview

https://deploy-preview-48344--material-ui.netlify.app/

Bundle size

Bundle Parsed size Gzip size
@mui/material ▼-159B(-0.03%) ▼-34B(-0.02%)
@mui/lab 0B(0.00%) 0B(0.00%)
@mui/private-theming 0B(0.00%) 0B(0.00%)
@mui/system 0B(0.00%) 0B(0.00%)
@mui/utils 0B(0.00%) 0B(0.00%)

Details of bundle changes


Check out the code infra dashboard for more information about this PR.

@mj12albert mj12albert force-pushed the form-control-state-hook branch from cc33db4 to 7da663a Compare April 21, 2026 12:56
return React.useContext(FormControlContext);
}

export function useFormControlState<Props, States extends readonly FormControlStateKey[]>({
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intentionally does not use the existing formControlState or useFormControl to maximize bundle size reduction, otherwise reusing those will increase the bundle size

@mj12albert mj12albert marked this pull request as ready for review April 21, 2026 13:26
@mj12albert mj12albert force-pushed the form-control-state-hook branch 3 times, most recently from bea518a to 614820d Compare April 27, 2026 09:40
Copy link
Copy Markdown
Member

@siriwatknp siriwatknp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No objection from me but I'll let @silviuaavram decide if he wants to push this forward.

Comment thread packages/mui-material/src/FormControlLabel/FormControlLabel.js
@mj12albert mj12albert force-pushed the form-control-state-hook branch from 8830b95 to e62c72f Compare April 29, 2026 10:56
@mj12albert mj12albert force-pushed the form-control-state-hook branch from e62c72f to bb6e3b3 Compare May 4, 2026 09:47
@mj12albert mj12albert force-pushed the form-control-state-hook branch from bb6e3b3 to 5f2aa76 Compare May 4, 2026 11:44
@mj12albert mj12albert enabled auto-merge (squash) May 5, 2026 11:44
@mj12albert mj12albert merged commit 7330289 into mui:master May 5, 2026
18 checks passed
@mj12albert mj12albert deleted the form-control-state-hook branch May 5, 2026 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal Behind-the-scenes enhancement. Formerly called “core”.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FormControl] New internal form control state hook

3 participants