@rhf-kit/mui
is a library of Material-UI components integrated with React Hook Form to provide seamless form control to your React apps.
Install
npm i @rhf-kit/mui
@rhf-kit/mui
requires the following peer dependencies:
react
^18.2.0react-hook-form
^7.51.3@mui/icons-material
^5.15.15@mui/material
^5.15.15@mui/x-date-pickers
^7.2.0
Components
-
Form Containers
-
Form Buttons
- FormButton - A button element that can be used to submit a form.
-
Inputs
-
Date and Time Pickers
-
Mobile Inputs
Usage
import { FormContainer, FormButton, FormTextFieldElement } from "@rhf-kit/mui";
interface IFormData {
firstName: string;
}
const Example = () => {
const onSubmit = (data: IFormData) => console.log(data);
const defaultValues: IFormData = {
firstName: "",
};
return (
<FormContainer defaultValue={defaultValues} onSubmit={onSubmit}>
<FormTextFieldElement name="firstName" label="First Name" />
<FormButton>Submit</FormButton>
</FormContainer>
);
};