Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DataGrid] Use new toolbar by default #16814

Merged
merged 17 commits into from
Mar 6, 2025
Merged

Conversation

KenanYusuf
Copy link
Member

@KenanYusuf KenanYusuf commented Mar 4, 2025

Part of #15823

  • Adds a new GridToolbar component for internal use only
  • Update the GridToolbarQuickFilter component to use the new QuickFilter components
  • Update the docs to use the new toolbar everywhere

Follow-up

Changelog

Breaking changes

  • The density selector has been removed from the toolbar. It is still possible to set the density programmatically via the density prop. A density selector can be added to a custom toolbar passed to slots.toolbar. See Toolbar component—Settings menu for an example.
  • The quick filter is now shown in the toolbar by default. Use slotProps={{ toolbar: { showQuickFilter: false } }} to hide it.
  • The <GridSaveAltIcon /> icon is not exported anymore. Import SaveAlt from @mui/icons-material instead.

@KenanYusuf KenanYusuf added breaking change component: data grid This is the name of the generic UI component, not the React module! design This is about UI or UX design, please involve a designer v8.x labels Mar 4, 2025
@@ -154,8 +154,7 @@ export interface GridSlotsComponent extends GridBaseSlots, GridIconSlotsComponen
*/
footerRowCount: React.JSXElementConstructor<GridSlotProps['footerRowCount']>;
/**
* Toolbar component rendered inside the Header component.
* @default GridToolbar
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think it makes sense to list a default component if it's only available internally

@joserodolfofreitas
Copy link
Member

Breaking changes

  • The density selector has been removed from the toolbar. It is still possible to set the density programmatically via the density prop. A density selector can be added to a custom toolbar passed to slots.toolbar. See Toolbar component—Settings menu for an example.
  • The quick filter is now shown in the toolbar by default. Use slotProps={{ toolbar: { showQuickFilter: false } }} to hide it.

Love the new defaults.

  • The <GridSaveAltIcon /> icon is not exported anymore.

I wonder if we must stop exporting GridSaveAltIcon, since I suppose we should still support the old custom toolbars?

@KenanYusuf
Copy link
Member Author

KenanYusuf commented Mar 5, 2025

I wonder if we must stop exporting GridSaveAltIcon, since I suppose we should still support the old custom toolbars?

This one is mainly a design decision because I don't think that icon fits with the other, much heavier, icons used in the toolbar.

Users using the old <GridToolbarExport /> component will get the updated icon without having to change anything. Users who were importing the GridSaveAltIcon icon directly can still import it from @mui/icons-material if they want to restore it—I will update the migration guide to suggest this.

@KenanYusuf KenanYusuf marked this pull request as ready for review March 5, 2025 12:35
@KenanYusuf KenanYusuf requested a review from a team March 5, 2025 12:39
Copy link
Contributor

@arminmeh arminmeh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update to the examples show how things are getting simpler for the end users 🙂

I found a small issue on some examples. Clicking on the toolbar button changes the scroll position

First demo on this page
https://deploy-preview-16814--material-ui-x.netlify.app/x/react-data-grid/filtering/

or this demo
https://deploy-preview-16814--material-ui-x.netlify.app/x/react-data-grid/filtering/multi-filters/#disable-action-buttons

@KenanYusuf
Copy link
Member Author

Update to the examples show how things are getting simpler for the end users 🙂

I found a small issue on some examples. Clicking on the toolbar button changes the scroll position

First demo on this page deploy-preview-16814--material-ui-x.netlify.app/x/react-data-grid/filtering

or this demo deploy-preview-16814--material-ui-x.netlify.app/x/react-data-grid/filtering/multi-filters#disable-action-buttons

@arminmeh I think this might be a bug with the focus trap used here: https://github.com/mui/mui-x/blob/master/packages/x-data-grid/src/material/index.tsx#L497-L506

I can replicate it on: https://next.mui.com/x/react-data-grid/filtering/multi-filters/#disable-action-buttons

@arminmeh
Copy link
Contributor

arminmeh commented Mar 6, 2025

@arminmeh I think this might be a bug with the focus trap used here: master/packages/x-data-grid/src/material/index.tsx#L497-L506

I can replicate it on: next.mui.com/x/react-data-grid/filtering/multi-filters#disable-action-buttons

OK. Then this can be fixed outside of the scope of this PR
Do we have issue for this already?

@KenanYusuf
Copy link
Member Author

@arminmeh I think this might be a bug with the focus trap used here: master/packages/x-data-grid/src/material/index.tsx#L497-L506
I can replicate it on: next.mui.com/x/react-data-grid/filtering/multi-filters#disable-action-buttons

OK. Then this can be fixed outside of the scope of this PR Do we have issue for this already?

I haven't seen one specific to the data grid, just found these issues which seem to be related:

@arminmeh
Copy link
Contributor

arminmeh commented Mar 6, 2025

There are a lot of other examples that are having custom buttons on top
Does it make sense to have a follow up to align all of those and put them in the toolbar, now that it can be easily customized

some examples
https://deploy-preview-16814--material-ui-x.netlify.app/x/react-data-grid/state/#direct-selector-access
https://deploy-preview-16814--material-ui-x.netlify.app/x/react-data-grid/state/#restore-the-state-with-initialstate (this one might even be updated now)
https://deploy-preview-16814--material-ui-x.netlify.app/x/react-data-grid/row-updates/#the-rows-prop

@KenanYusuf KenanYusuf merged commit 25ef40e into mui:master Mar 6, 2025
18 checks passed
@KenanYusuf KenanYusuf deleted the grid-toolbar-v8 branch March 6, 2025 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change component: data grid This is the name of the generic UI component, not the React module! design This is about UI or UX design, please involve a designer v8.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants