FormField#

This component extends Controller component of react-hook-form and is meant to be used with material-ui components.

Can't be used outside <Form>.

Example#

import { useForm } from 'react-hook-form';
import TextField from '@material-ui/core/TextField';
import { Form, FormField } from 'la-danze-ui';
function App() {
const form = useForm();
return (
<Form form={form}>
<FormField
name="email"
as={TextField}
rules={{ required: { value: true, message: 'Email is required' } }} />
...
</Form>
);
}

Props#

Extends Controller props

Additional props:

NameTypeDefaultRequiredDescription
errorbooleanNoWeither field is in error or not.
helperTextstringNoError message to display.
disabledbooleanNoWeither field is disabled or not.