TextField is composed of smallar components-FormControl, FormLabel, FormerHelperText, and Input.
You can either use each one of them separately or plainly use the TextField itself.
This is a helper text.
<FormControl><FormLabel>Label</FormLabel><Inputplaceholder="Placeholder"/><FormHelperText>This is a helper text.</FormHelperText></FormControl>
Press Enter to start editing
Variants
The text field component supports the four global variants: solid (default), soft, outlined, and plain.
<TextFieldlabel="Solid"placeholder="Type in here…"variant="solid"/><TextFieldlabel="Soft"placeholder="Type in here…"variant="soft"/><TextFieldlabel="Outlined"placeholder="Type in here…"variant="outlined"/><TextFieldlabel="Plain"placeholder="Type in here…"variant="plain"/>
Press Enter to start editing
Sizes
The text field component comes with three sizes out of the box: sm, md (the default), and lg.
Toggle the palette that's being used to color the by text field by using the color prop.
Form props
Standard form attributes are supported e.g. required, disabled, type, etc. as well as a helperText which is used to give context about a field's input, such as how the input will be used.
This is a helper text
<TextFieldlabel="Label"placeholder="Type in here…"required/><TextFieldlabel="Label"placeholder="Type in here…"disabled/><TextFieldlabel="Label"placeholder="Type in here…"helperText="This is a helper text"/>
Press Enter to start editing
Validation
To toggle the error state, use the error prop.
And, to provide feedback about the error to the user, use the helperText prop.
You got this wrong. Try again!
<TextFieldlabel="Label"placeholder="Type in here…"errorhelperText="You got this wrong. Try again!"/>
Press Enter to start editing
Input decorators
Use the startDecorator and/or endDecorator props to add supporting icons or elements to the text field.
New stuff
Full width
To make the text field take up the full width of its container, use the fullWidth prop.
<TextFieldlabel="Label"placeholder="Type in here…"fullWidth/>
Press Enter to start editing
Unstyled
The component also comes with an unstyled version. It's ideal for doing heavy customizations and minimizing bundle size.