-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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] Style DataGrid Column Menu and text inside GridToolbarColumnsButton #3686
Comments
Hi, @zprpic thanks for reporting this! |
Sorry! I must've been not clear enough. These current styles in the code work. However, automatically has text "Columns" inside it. I would love if it were changeable to something else, maybe even just an empty string. Considering the DataGrid stylings inside the ColumnMenu, I don't understand the docs completely. Could you exemplify how you would style the buttons/checkboxes inside the ColumnMenu of DataGrid? Thanks! |
For changing the text you can use the For the styling you can simply target the CSS class directly: <DataGrid
sx={{
'& .MuiDataGrid-menu': {
background: red,
},
}}
/> |
Hi! I tried out the piece of code, but the styling didn't work at all. It wasn't applied. :/
Is there a way to turn the toggle buttons inside the ColumnMenu to checkboxes as well? |
Yes, customizing panels, such as the column menu or the filter panel is a bit more complex than usual components. The following code you use add a CSS selector looking for components with class sx={{
'& .MuiDataGrid-menu': { background: red, }
}} A solution is to use the <DataGrid
componentsProps={{
basePopper: {
sx: {
/* Now we have access to column menu style*/
}
}
}}
/> The question is now, what to write inside
You can experiment with this different options in the following demo: |
I missed a simpler solution. There exist the <DataGrid
componentsProps={{
columnMenu: {
sx: {
/* style allied to the column menu */
backgroundColor: "orange" // for example
}
}
}}
/> |
Wow! These are great and super simple solutions. Thanks! However, 2 of my questions still remain unanswered and I'm still not sure how to approach them:
|
If you are talking about this panel, you have two options:
For your second point, this answer linked you to the doc with all the information about text translation: #3686 (comment) I think, your point is explained at the end of the page
|
No solution is up to date, I hate MUI !!!! |
Duplicates
Latest version
Summary 💡
I'd love to be able to customize the buttons and padding and background colours inside the ColumnMenu of DataGrid where you choose which fields should be shown.
Also, I'd love to be able to customize and change the text inside GridToolbarColumnsButton component.
Examples 🌈
<GridToolbarColumnsButton startIcon={<MoreHorizIcon />}
<DataGridpanel: { sx: { '& .MuiTypography-root': { color: 'dodgerblue', fontSize: 20, background: 'red', }, '& .MuiDataGrid-filterForm': { bgcolor: 'lightblue', }, }, }, }} />
Motivation 🔦
No response
Order ID 💳 (optional)
No response
The text was updated successfully, but these errors were encountered: