Comments (11)
Hey @fdebef ... i am not sure why we did this change (@romgrk would be the best to answer this), but you can easily change the background color by using the CSS variable:
const defaultTheme: Theme = createTheme({
typography: {
fontSize: 14,
fontFamily: 'Roboto Condensed',
},
components: {
MuiDataGrid: {
styleOverrides: {
root: {
'--DataGrid-containerBackground': 'rgb(69,153,236)',
},
},
},
},
});
That being said: @mui/xgrid should we maybe export a constant similar to gridClasses
for the variables to make them easier to override?
from mui-x.
We needed access to the color. The doc explains how to customize it here: https://mui.com/x/react-data-grid/style/#theme-header-and-pinned-sections
from mui-x.
A bit confusing compared to columnHeaders but OK .
But neither you, nor documentation talks about the color property. (color of header text). How would you change it.
BUT!!!! Within playing with this stuff I think I've discovered the issue:
In version 6.8 you use the selector
.MuiDataGrid-columnHeaders
And so is it rescribed in documentation
https://mui.com/x/api/data-grid/data-grid/#DataGrid-css-MuiDataGrid-columnHeaders
But in 7.5 you switched to
.MuiDataGrid-columnHeader
(omitting the last s)
Is it intention or mistake?
from mui-x.
We actually have both columnHeaders
which is the container holding all headers and columnHeader
which is a single header.
The color is defined on the root component, so a more specific selector should be easily able to overwrite that.
adding this will change the text color:
[`& .${gridClasses.columnHeader}`]: {
color: 'white',
},
I do agree though that we could improve the theming capabilities, since this change would not affect the icon buttons.
@romgrk is currently working on making the grid theme agnostic, so insight here is very valuable.
For now we would need to use more specific selectors to target the icon buttons, etc. separately.
from mui-x.
I have tried in Stackblitz, and it really works. There is something wrong with my project, maybe relating to this issue, too:
#13483 (comment)
Might it be the combination of Tailwind and Mui? I really want to stay on Mui DataGrid, but need other styling with Tailwind.
from mui-x.
No, the combination of Tailwind and Mui X shouldn't be a problem.
We just recently (on a conference in Amsterdam) heard from users who effectively use both and it works great for them.
The only thing I could think if is the tailwind build-process.
But without knowing the setup it is hard to tell.
I will try and setup a project with it ... @joserodolfofreitas this might be another case to add as a how-to to the docs. WDYT?
from mui-x.
@fdebef can you provide your setup specifics, so we can check that? Otherwise there isn't really that much we can do right now unfortunately.
from mui-x.
I'm stuck here.
This is the simpliest project, where I experience different behavior in IntelliJIdea Ultimate (not working) and VS Code (working).
I've created very new project in IntelliJ and it behaves the same:
Issue with columnHeader/s
TypeScript type for Theme not working (another issue here)
I suggest to close this issue as it seems like it is not yours problem - in VS Code everything is working. A highly appreciate your effort to me, thank you very much.
from mui-x.
this might be another case to add as a how-to to the docs. WDYT?
Yes, for sure.
In fact, styling the Data Grid with Tailwind is one of the most relevant examples we want to showcase.
from mui-x.
I'm stuck here. This is the simpliest project, where I experience different behavior in IntelliJIdea Ultimate (not working) and VS Code (working). I've created very new project in IntelliJ and it behaves the same: Issue with columnHeader/s TypeScript type for Theme not working (another issue here)
I suggest to close this issue as it seems like it is not yours problem - in VS Code everything is working. A highly appreciate your effort to me, thank you very much.
@fdebef That's indeed strange. I am using IntelliJ Webstorm and there is no problem with it. But knowing the IDEs there is a ton of customization and settings that can totally change the behavior. I would try to check settings and plugins to see if something might be off there.
I will close this issue now, but feel free to comment a solution anyways if you find one so others encountering this problem can find it! Thanks! 🙇🏼
from mui-x.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.
@fdebef: How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey.
from mui-x.
Related Issues (20)
- [data grid] CSV export adds malformed/buggy characters HOT 2
- [TreeView] Expose the item slots at the tree view level
- [data grid] Is Clipboard cut available? HOT 1
- [data grid] Save / Restore state with dynamic columns HOT 7
- [pickers] dayjs with default timezone broke picker HOT 2
- [pickers] Page fails to load Date Picker Component with Joy UI using CssVarsProvider Wrapper HOT 5
- [charts] Improve default color contrast in dark mode HOT 9
- [RFC] Move to a more modular structure for tests in code and CI HOT 4
- Add Audio Player/Waveform component HOT 2
- [charts] Cannot scroll the page when touch inside the chart HOT 7
- [data grid] Pivoting ETA HOT 4
- Pie Chart shows a slice for 0 value whenever the object representing a 0 is last in the array HOT 2
- [DataGrid] CSV export negative numbers in string has quotation HOT 3
- [data grid] Is there a way to override the default copy/paste functionality in DataGrid? HOT 7
- New sets of components HOT 6
- [charts] BarChart legend overlaps charts area HOT 3
- [pickers] Recipes HOT 1
- [data grid] I want to add Apply and Cancel buttons to the GridToolbarFilterButton HOT 5
- [pickers][DateTimeRangePicker] Manually selecting the date then selecting the time in the popover reverts the date to today HOT 2
- [charts] Support single color area chart HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mui-x.