Collecting user input
Collecting input from users can be difficult. There are many nuanced things about every field that we need to consider if we plan on getting the user experience right. Thankfully, the Form
components available in Material UI take care of a lot of usability concerns for us. In this section, you’ll get a brief sampling of the input controls that you can use.
Checkboxes and radio buttons
Checkboxes are useful for collecting true/false
answers from users, while radio buttons are useful for getting the user to select an option from a short number of choices. Let’s take a look at an example of these components in Material UI:
export default function Checkboxes() {
const [checkbox, setCheckbox] = React.useState(false);
const [radio, setRadio] = React.useState("First");
return (
<div>
<FormControlLabel
label={'Checkbox ${checkbox ? "(checked)" : ""}'}
control={...