Answers for "material ui textfield error"

0

material ui textfield error

Using a react component state, one can store the TextField value and use that as an indicator for an error. Material-UI exposes the error and helperText props to display an error interactively.

Take a look at the following example:

<TextField
  value={this.state.text}
  onChange={event => this.setState({ text: event.target.value })}
  error={text === ""}
  helperText={text === "" ? 'Empty field!' : ' '}
/>
Posted by: Guest on March-12-2021

Code answers related to "material ui textfield error"

Browse Popular Code Answers by Language