[data grid] Toolbar button slotProps
get overwritten by slotProps.baseButton
#13416
Labels
bug 🐛
Something doesn't work
component: data grid
This is the name of the generic UI component, not the React module!
customization: css
Design CSS customizability
Steps to reproduce
Link to live example: https://codesandbox.io/p/sandbox/focused-pike-nzz36y?file=%2Fsrc%2FDemo.tsx
Steps:
slotProps={{ baseButton: { variant: "contained", color: "primary" } }}
GridToolbarColumnsButton
slotProps={{ button: { variant: "outlined", color: "secondary" } }}
Current behavior
The
slotProps.baseButton
props take precedence over theslotProps.button
props onGridToolbarColumnsButton
.Expected behavior
When rendering individual buttons within the toolbar, I should be able to customize the button variant, color etc.
In the above example, the toolbar column button should be the
outlined
variant andsecondary
color.I haven't dived into this too much, but I think we need to switch the order of
{...buttonProps}
and{...rootProps.slotProps?.baseButton}
on these buttons:https://github.com/mui/mui-x/blob/master/packages/x-data-grid/src/components/toolbar/GridToolbarColumnsButton.tsx#L72-L74
Context
Trying to style toolbar buttons differently to the other buttons in the UI.
Your environment
No response
Search keywords: data grid slotProps baseButton toolbar button props
The text was updated successfully, but these errors were encountered: