useFormControl

useFormControl is a custom hook to inherit values from the FormControl utility in your custom-built form fields.


Usage

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

If you're using Arcade 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