Michael Nelles
Michael Nelles

Reputation: 5992

React Material UI table add custom button

This is a question specific to MaterialTable. I have gone through the docs and the API but can not find an efficient way to customize the Actions column and add an icon for view details.

I am working with a relational database and would like to be able to link it for each user on their row.

Add Button after trash can

Upvotes: 0

Views: 4728

Answers (1)

Reed Dunkle
Reed Dunkle

Reputation: 3587

The Material Table documentation states that you can pass an array of actions to the actions prop on the MaterialTable component.

Each action element in the array can have fields specified, which include icon and onClick. icon can be a custom component.

Here's the example from the documentation linked above:

<MaterialTable
  // other props
  actions={[
    {
      icon: 'save',
      tooltip: 'Save User',
      onClick: (event, rowData) => {
        // Do save operation
      }
    }
  ]}
/>

Upvotes: 2

Related Questions