Form is a controller for input fields
## Usage - use `Form` to wrap inputs within it - use `FormTextField`, `FormSwitch` components , these components are enabled to work with in the form - use `withResetButton` and `withSubmitButton` helpers to add reset and submit buttons ```typescript import { Form, FormProps, FormTextField, FormSwitch, withSubmitButton } from "mui-extended"; import { TextField, Button } from "@mui/material"; const formProps: FormProps; const ResetButton = withResetButton(Button); const SubmitButton = withSubmitButton(Button); const form = ( <Form {...formProps}> <FormTextField name="username" /> <FormSwitch name="remember" InputProps={{ formControlLabelProps: { label: "Remember Me", labelPlacement: "end" } }} /> <ResetButton>Reset</ResetButton> <SubmitButton>Submit</SubmitButton> </Form> );
JSON SchemaInitializes and manages FormContext
Props
initialValuesinitialErrorsonSubmitschemasvalidators(name: string, value: unknown) => Promise<void>use
useFormContextvalue contains
valuestouchederrorsisDirtyisValidisSubmittingonFieldChange(name: string, value: unknown) => voidonFieldBlur(name: string) => voidsubmitresetFollowing props of any Input component are used to control Input with in the Form.
namevalueonChangeonFieldChangeonBluronFieldBlurlabelerrorhelperTextdisabledwithFormFieldThe default Input components provided by
material-uiwithFormFieldSpecific wrapper components are created for each Input from
material-uiAll Wrapper Components are described here
This is not a FormAutocomplete
label is auto generated from name
label is auto generated from name
{}
Write an email to opensource@sodaru.com