-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[charts] Create charts toolbar #17557
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
Comments
The Data Grid's toolbar follows a composable approach that relies on Here's an example of how to use custom components in the Data Grid's toolbar. To me, it seems like the container/presentational component split: the Data-Grid-exported components are containers (e.g., The Data Grid uses a The For slots that are used in the Concluding, while complex, the Data Grid toolbar seems to be composable, customizable and include accessibility out of the box. Unfortunately, since the fallback components can be rendered at runtime (i.e., bundlers can't know whether they're used or not), I think bundlers won't be able to tree-shake |
If we look from a usecase perspective, you have:
The base slots is an object that matches keys to components. Which are for now a wrapping around material components, which should allow the data grid to be somewhat indepenendt in terms of props API form the core team. About tree-shaking, we can imagine to set the default value of the slots to be light in the unstiled package
And in the one made to match with the core package
Such that |
Yeah, I think that sums it up well.
Yeah, that could work. Another option that would be slightly cumbersome but wouldn't require a separate package would be to force users to register default slots in the App's entry point. import { registerDefaultSlots } from '@mui/x-charts';
import materialDefaultSlots from '@mui/x-charts/material';
registerDefaultSlots(materialDefaultSlots); I don't love that we would need to register the default slots in a single entry-point, so an alternative would be to follow the However, this could cause some issues as well. For example, if you want to migrate from material slots, all imports would need to be updated, and incremental migration wouldn't be possible because having a single import from This was just an idea I wanted to write as it might spur some other idea. |
@bernardobelchior @alexfauquette it would be good to sync with @romgrk on how we are approaching the material/core packages for Data Grid. We should try to solve this problem in the same way across mui-x components. |
Thanks, @KenanYusuf! At the moment, I'm following the Data Grid's approach of slots + render props to maintain consistency. One thing I noticed is that it might be hard to tree-shake |
The grid will have separate packages for the core grid and the material grid. The material grid can't tree-shake away |
Uh oh!
There was an error while loading. Please reload this page.
Similar to the data grid's toolbar.
We probably want to hide the toolbar when exporting.
Unblocks:
The text was updated successfully, but these errors were encountered: