
Product
Introducing Reachability for PHP
Reachability analysis for PHP is now available in experimental, helping teams identify which vulnerabilities are actually exploitable.
material-ui-hook-form
Advanced tools
A set of wrapper components to facilitate using Material-UI with React Hook Form
A set of wrapper components to facilitate using Material-UI with React Hook Form
This component can use inside
<Fields>
You can pass any props from TextField to Field.
Additional props from React Hook Form:
name: string - name is required and unique. Input name also supports dot and bracket syntax, which allows you to easily create nested form fields. Read morecontrol?: Control - control object is from invoking useForm. it's optional if you are using FormContext.required?: string | ValidationOptionObject<boolean>min?: ValidationOptionObject<number | string>max?: ValidationOptionObject<number | string>maxLength?: ValidationOptionObject<number | string>minLength?: ValidationOptionObject<number | string>pattern: ValidationOptionObject<RegExp>validate?: Validate | Record<string, Validate>Addtional props:
disableErrorMessage?: boolean - Hide error message when truedisableLabel?:boolean - Hide label when true// Text
<Field name="firstName" />
<Field name="firstName" required maxLength={5} minLength={3} />
<Field name="phone" pattern={/^\d+$/} />
// TextArea
<Field name="note" multiline rows={4} />
<Field
name="note"
multiline
rows={4}
validate={v =>
v
? String(v)
.toLowerCase()
.includes('mui') || 'note must include word `mui`'
: undefined
}
/>;
// Select
<Field name="department" options={['HR', 'accounting', 'shipping']} />
// Select with render props
<Field name="department">
{DEPARTMENTS.map(option=> {
<MenuItem key={option} value={option}>{option}</MenuItem>
})}
</Field>
This component can use inside
<Fields>
You can pass any props from TextField to FieldNumber except select, SelectProps.
You can pass any props from React Number Format
Additional props from React Hook Form:
name: string - name is required and unique. Input name also supports dot and bracket syntax, which allows you to easily create nested form fields. Read morecontrol?: Control - control object is from invoking useForm. it's optional if you are using FormContext.required?: string | ValidationOptionObject<boolean>min?: ValidationOptionObject<number | string>max?: ValidationOptionObject<number | string>validate?: Validate | Record<string, Validate>Addtional props:
disableErrorMessage?: boolean - Hide error message when truedisableLabel?:boolean - Hide label when true// Number
<FieldNumber name="age" />
// Currency, $ 150,000
<FieldNumber name="salary" min={150000} thousandSeparator prefix="$ " md={4} />
If you need to build advanced Number Format, you can leaveage <FieldNumberFormat />
// A Money Format that will store user input as smallest currency unit and display as regular format.
// e.g. $100 => 100000
function CurrencyFormat({ value, onChange, currency = 'USD', ...other }: any) {
const [maskValue, setMaskValue] = React.useState(value / 100);
React.useEffect(() => setMaskValue(value / 100), [value]);
return (
<NumberFormat
value={maskValue}
isNumericString
thousandSeparator
onValueChange={target => {
if (target.floatValue) {
setMaskValue(target.floatValue);
onChange(target.floatValue * 100);
}
}}
customInput={TextField}
prefix={getCurrencyPrefix(currency)}
decimalScale={getCurrencyDecimalScale(currency)}
{...other}
/>
);
}
interface FieldMoney extends Except<FieldNumberFormat, 'as'> {
currency?: CurrencyEnum;
}
function FieldMoney({ className, ...other }: FieldMoney) {
return <FieldNumberFormat {...other} as={CurrencyFormat} className={clsx(className)} />;
}
export default FieldMoney;
This component can use inside
<Fields>
You can pass any props from Autocomplete to FieldAutocomplete.
You can pass any props from TextField to FieldAutocomplete except onChange, select, SelectProps.
Additional props from React Hook Form:
name: string - name is required and unique. Input name also supports dot and bracket syntax, which allows you to easily create nested form fields. Read morecontrol?: Control - control object is from invoking useForm. it's optional if you are using FormContext.required?: string | ValidationOptionObject<boolean>validate?: Validate | Record<string, Validate>Addtional props:
disableErrorMessage?: boolean - Hide error message when truedisableLabel?:boolean - Hide label when trueFieldAutocomplete has a default renderInput implementation, which just a TextField with error message, All TextField props will forwarded to TextField. You can override renderInput if needed.
(params: RenderInputParams) => (
<TextField
fullWidth
required={!!required}
label={!naked ? label ?? getInputLabelFromName(name) : undefined}
helperText={!naked ? error?.message ?? helperText : undefined}
error={!!error}
variant={variant as any}
{...params}
{...other}
/>
);
// Autocomplete
<FieldAutocomplete name="gender" options={['male', 'female']} />
<FieldAutocomplete name="gender" options={['male', 'female']} required />
<FieldAutocomplete
name="gender"
options={['male', 'female', 'other']}
validate={v=> v === 'other' || 'Only other is allowed'}
/>
You can pass any props from RadioGroup to FieldRadioGroup.
Additional props from React Hook Form:
name: string - name is required and unique. Input name also supports dot and bracket syntax, which allows you to easily create nested form fields. Read morecontrol?: Control - control object is from invoking useForm. it's optional if you are using FormContext.required?: string | ValidationOptionObject<boolean>Addtional props:
label?: string - Form LabeldisableErrorMessage?: boolean - Hide error message when trueoptions: (string | { value: string; label?: string })[] - self describedhelperText?: string - @see TextField#helperTextdisabled?: boolean - @see TextField#disabled// TODO
You can pass any props from <form />.
Additional props:
form?: FormContextValues - If you pass the form object got from invoking useForm(). It will wrap a FormContext for youdebug?: boolean - TODOinterface Form extends React.FormHTMLAttributes<HTMLFormElement> {
form?: FormContextValues;
debug?: boolean;
}
function Form({ form, ...other }: Form) {
const component = <form noValidate {...other} />;
return form ? <FormContext {...form}>{component}</FormContext> : component;
}
You can pass any props from Grid to Fields except container and item.
spacing=2 default valuexs=12 default value.// All field now wrapped with <Grid item xs={12} md={6}/> You can override this by pass breakpoints to individual `Field`
<Fields md={6}>
<Field name="department" md={12} />
<Field name="firstName" />
<Field name="lastName" />
<FieldNumber name="age" md={4} />
<FieldNumber name="salary" md={4} />
<Field name="phone" md={4} />
<Field name="note" />
</Fields>
A button with loading indicator and disabled while submitting
You can pass any props from Button to Submit
Additional props from React Hook Form:
control?: Control - control object is from invoking useForm. it's optional if you are using FormContext.Addtional props:
loading?: boolean - Disable button and show loading indicator when true, it's optional if you are using FormContextconst form = useForm();
<Form
form={form}
onSubmit={form.handleSubmit(async () => {
// sleep
await new Promise(resolve => setTimeout(resolve, 2000));
})}
>
<Submit />
</Form>;
In order to make your form looks good, you should customize material-ui with your theme.
Here is the default theme we used in storybook example
createMuiTheme({
props: {
MuiFilledInput: {
disableUnderline: true,
},
MuiTextField: {
margin: 'none',
size: 'small',
variant: 'filled',
},
MuiFormHelperText: {
variant: 'filled',
},
MuiInputLabel: {
shrink: true,
variant: 'filled',
},
MuiFormControl: {
margin: 'none',
variant: 'filled',
},
},
overrides: {
MuiInputBase: {
input: {
'&$disabled': {
cursor: 'not-allowed',
},
},
},
MuiFilledInput: {
root: {
borderRadius: 4,
},
},
},
});
FAQs
A set of wrapper components to facilitate using Material-UI with React Hook Form
We found that material-ui-hook-form demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Reachability analysis for PHP is now available in experimental, helping teams identify which vulnerabilities are actually exploitable.

Product
Export Socket alert data to your own cloud storage in JSON, CSV, or Parquet, with flexible snapshot or incremental delivery.

Research
/Security News
Bitwarden CLI 2026.4.0 was compromised in the Checkmarx supply chain campaign after attackers abused a GitHub Action in Bitwarden’s CI/CD pipeline.