Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to change material table action fields icon

        actions={[
          {
            icon: 'edit',
            tooltip: 'Edit User',
            onClick: (event, rowData) => alert('You are editing ' + rowData.name)
          },
          {
            icon: 'delete',
            tooltip: 'Delete User',
            onClick: (event, rowData) => confirm('You want to delete ' + rowData.name)
          }
        ]}
like image 831
Jargalan Avatar asked Sep 16 '25 07:09

Jargalan


1 Answers

You can change the icon of the action by supplying arbitrary React component as the value for icon prop.

icon string or () => ReactElement - Icon of button from material icons or custom component

So instead of edit or delete, add a component of a desired icon. Something like:

import { Edit } from '@material-ui/icons'

// ...

{
  icon: () => <Edit />,
  tooltip: 'Edit User',
  onClick: (event, rowData) => alert('You are editing ' + rowData.name)
},

// ...
like image 99
jayarjo Avatar answered Sep 19 '25 13:09

jayarjo