-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[data grid] Dark mode DataGridPro Pinning #15496
Comments
Hey @funnyjk ... I do agree that we could be a bit better at supporting themes OOTB, but for this specific use case there is a very easy workaround. Since the rows are all transparent and the effect colors are opaque you can just use a background on the wrapping div element: <ThemeProvider theme={darkTheme}>
<div style={{ height: 400, width: '100%', backgroundColor: '#1c1c1c' }}>
<DataGridPremium
apiRef={apiRef}
columns={columns}
rows={rows}
slots={{
toolbar: GridToolbar,
}}
slotProps={{
columnsManagement: {
getTogglableColumns,
},
}}
/>
</div>
</ThemeProvider> It will then look something like this: Would that suit your use case? |
In your example, you need to include the import * as React from "react";
import * as ReactDOM from "react-dom/client";
import { StyledEngineProvider } from "@mui/material/styles";
import Demo from "./Demo";
import { ThemeProvider, createTheme } from "@mui/material/styles";
import { CssBaseline } from "@mui/material";
const darkTheme = createTheme({
palette: {
mode: "dark",
},
});
ReactDOM.createRoot(document.querySelector("#root")!).render(
<React.StrictMode>
<ThemeProvider theme={darkTheme}>
<StyledEngineProvider injectFirst>
<CssBaseline />
<Demo />
</StyledEngineProvider>
</ThemeProvider>
</React.StrictMode>
); |
I included the CssBaseline already, but the background fix does not work for the pinned columns. |
Steps to reproduce
Steps:
Current behavior
the dark mode messes up the theming for the datagridpro
Expected behavior
the dark mode should work for the datagridpro
Context
The dark mode worked perfectly for the regular datagrid. not the datagridpro
Your environment
FireFox was usednpx @mui/envinfo
System:
OS: Windows 11 10.0.22631
Binaries:
Node: 22.11.0 - C:\Program Files\nodejs\node.EXE
npm: 10.9.0 - C:\Program Files\nodejs\npm.CMD
pnpm: Not Found
Browsers:
Chrome: Not Found
Edge: Chromium (129.0.2792.65)
npmPackages:
@emotion/react: ^11.13.3 => 11.13.3
@emotion/styled: ^11.13.0 => 11.13.0
@mui/core-downloads-tracker: 6.1.7
@mui/icons-material: ^6.1.7 => 6.1.7
@mui/material: ^6.1.6 => 6.1.7
@mui/private-theming: 6.1.7
@mui/styled-engine: 6.1.7
@mui/styled-engine-sc: ^6.1.7 => 6.1.7
@mui/system: 6.1.7
@mui/types: 7.2.19
@mui/utils: 6.1.7
@mui/x-data-grid: ^7.22.2 => 7.22.2
@mui/x-data-grid-pro: ^7.22.2 => 7.22.2
@mui/x-internals: 7.21.0
@mui/x-license: ^7.21.0 => 7.21.0
@types/react: ^18.3.12 => 18.3.12
react: ^18.3.1 => 18.3.1
react-dom: ^18.3.1 => 18.3.1
styled-components: ^6.1.13 => 6.1.13
typescript: ~5.6.2 => 5.6.3
Search keywords: dark mode pinning data grid
Order ID: 102029
The text was updated successfully, but these errors were encountered: