Search code examples
javascriptreactjsmaterial-uifrontendmaterial-table

How to add custom checkbox in column in react material table?


Hi i am using material table in react project. I want to add a checkbox in my table cell. For example in Birth year colume in place of 1987. How to achieve that?

https://codesandbox.io/s/material-demo-forked-5h51b?file=/demo.js:701-911

enter image description here

<MaterialTable
      title="Editable Example"
      columns={state.columns}
      data={state.data}
      options={{
        selection: true
      }}
      editable={{
       //Edit Code here
      }}
    />

Solution

  • I found the answer... In column just add type:'boolean'. For eg,

        {
          title: "Unit",
          field: "unit",
          type: 'boolean',
          
        },