Search code examples
reactjsmaterial-uidatagridcustomization

Customize MUI Gridtoolbar


I'm using MUI Datagrid and i wanna know if there is a way to customize the gridtoolbar with custom buttons and text.

Thanks.

Federico

This is the toolbar i wanna customize


Solution

  • The components prop is depricated. Now, you can do:

    <DataGrid
      {...data}
      slots={{
        toolbar: CustomToolbar,
      }}
    />
    
    function CustomToolbar() {
      return (
        <GridToolbarContainer>
          <GridToolbarColumnsButton />
          <GridToolbarFilterButton />
          <GridToolbarDensitySelector />
          <GridToolbarExport />
        </GridToolbarContainer>
      );
    }