0

I am using the community version of @mui/x-data-grid.

I have this column defintion:

const columns = [
  {
    field: "actions",
    type: "actions",
    width: 100,
    getActions: (cell) => [
      <GridActionsCellItem
        label={strings.addSome}
        onClick={() => openAddModal(cell.row)}
        showInMenu
      />,
      <GridActionsCellItem
        label={strings.pickSome}
        onClick={() => openPickModal(cell.row)}
        showInMenu
      />,
      <GridActionsCellItem
        label={strings.remove}
        onClick={() => openRemoveModal(cell.row)}
        showInMenu
      />,
      <GridActionsCellItem
        label={strings.modifyQty}
        onClick={renderComingSoon}
        showInMenu
      />,
    ],
  },
];

This result in the following output:

enter image description here

I want to change the display icon for the action menu button, is there an option to do si?

Olivier Tassinari
  • 8,238
  • 4
  • 23
  • 23
Normal
  • 1,616
  • 15
  • 39

2 Answers2

0

DataGrid component has components prop, which allows to replace almost any default component with custom one. I'm pretty sure that you need BaseButton to be like

const CustomButton = () => (
    <IconButton>
        <AnyIconFromMUIIconSet />
    </IconButton>
);

<DataGrid
    components: {
        BaseButton: CustomButton
    }
    // rest of your props

For more information about Slots please refer to DataGrid API.

lazy.lizard
  • 834
  • 6
  • 11
0

The moreActionsIcon slot is needed. To show horizontal dots instead of vertical and with a smaller size, this worked. (MUI DataGrid v5.12.1)

import MoreHorizRoundedIcon from '@mui/icons-material/MoreHorizRounded'


    function CustomActionsIcon () {
      return (
        <MoreHorizRoundedIcon sx={{ fontSize: 25 }} />
      )
    }
    
    <DataGrid
        components={{
            MoreActionsIcon: CustomActionsIcon
         }}

Horizontal dots instead of vertical!

Jim
  • 359
  • 2
  • 15