React Material UI Indeterminate Checkbox Example Tutorial

Pinterest LinkedIn Tumblr

To create an indeterminate checkbox in React using Material-UI, you can use the Checkbox component and set the “indeterminate” prop to true. Here is an example:

Copy codeimport { Checkbox } from "@material-ui/core";

function IndeterminateCheckbox() {
  const [indeterminate, setIndeterminate] = React.useState(false);

  return (
      onChange={(event) => setIndeterminate(}

In this example, we use the Checkbox component from Material-UI and create a state variable called “indeterminate” to keep track of the checkbox’s indeterminate state. The “indeterminate” prop is set to the value of the “indeterminate” state variable.

We also handle the onChange event for the checkbox and update the “indeterminate” state variable with the value of the “indeterminate” property of the event’s target.

You can also add label and style to the checkbox as per your requirement.

Copy code<Checkbox
      onChange={(event) => setIndeterminate(}
      label="Select All"
      style={{color: "green"}}

You can also use this component with a label, and style it as you like.

Write A Comment