Text Field
Please refer to MUI's official docs for more details on component's usage guide and API documentation.
Use variant={'filled' | 'standard'}
prop for different text fields.
Standard form attributes are supported e.g. required
, disabled
, type
, etc. as well as helperText
which is used to give context about a field's input, such as how the input will be used.
Some important text
Manage value
prop with the help of a state for controlled TextField
and use defaultChecked
prop for uncontrolled TextField
.
Use size
prop for different sizes of text fields.
color={'secondary' | 'success' | 'error' | 'warning' | 'info'}
prop changes the highlight color of the text field when focused.
The main way is with an InputAdornment
. This can be used to add a prefix, a suffix or an action to an input. For instance, you can use an icon button to hide or reveal the password.
There are multiple ways to display an icon with a text field.
The error
prop toggles the error state, the helperText
prop can then be used to provide feedback to the user about the error.
fullWidth
can be used to make the input take up the full width of its container.
margin
prop can be used to alter the vertical spacing of inputs. Using none
(default) doesn't apply margins to the FormControl
whereas dense
and
normal
do.
Some important text
Some important text
Some important text
TextField
is composed of smaller components (FormControl
, Input
, FilledInput
, InputLabel
, OutlinedInput
, and FormHelperText
) that you can leverage directly to significantly customize your form inputs.
Some important helper text
Disabled
Error
Use styled
hook to customize your text field.