[FormControl] Expose the form control state
See original GitHub issueHow does one get the Context managed by a <FormControl/>
into one’s own component that is intended to be a child of the <FormControl/>
. The form control does not seem to pass disabled, focused, error as properties and also does not use React’s new context API. Could you add this answers to the documentation somewhere.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:15 (9 by maintainers)
Top Results From Across the Web
FormGroup and FormControl in Angular - LogRocket Blog
Form groups wrap a collection of form controls. Just as the control gives you access to the state of an element, the group...
Read more >mui/material-ui - [FormControl] Expose the form control state
In my case I agree that there is no need to update FormControlContext from parent without using props. Handlers (onBlur, ...) exposed on ......
Read more >Angular Custom Form Controls - Complete Guide
In this guide, we are going to learn exactly how to take an existing custom form control component and make it fully compatible...
Read more >Get access to FormControl from the custom form component in ...
I'm injecting the parent FormGroup to the component and then getting the specific FormControl from it using control name obtained through ...
Read more >FormControl - Angular
Tracks the value and validation status of an individual form control. ... Construct a FormControl with no initial value or validators.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Interesting, we will remove
withFormControlContext
in the near future. I propose we replace it with auseFormControlState
(#15231). I believe that we could expose this hook.I’m implementing a wrapper controlled component (with styling and some additional functionality) around
TextField
. I’m using Storybook for testing/documenting this.I would like to be able to write a story that “forces” this component in other states (e.g. focus).
From code, I inferred this could be done by exposing FormControlContext, which is why I’m writing my use case in this issue. 😃
It would be easiest if I could write something like: