useFormControl



Usage

When using FormControl utility – you would usually pass properties to it that should also affect your form field. For instance, passing the disabled flag to FormControl should also change the field color and prevent the user from interacting with it.

If you're using Reshaped form field components – they are already using useFormControl inside them, so this logic is supported automatically. However, if you're building a custom input component, useFormControl is where you can get data for inheriting the FormControl properties values.

For instance, you can create a custom input component with the hook:

Then it will automatically get access to values used in the FormControl your input is wrapped with:

Arguments and return value

Previous
Next