Skip to content
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

EuiDataGrid not change theme with EuiProvider colorTheme #7990

Closed
hieunv2011 opened this issue Aug 29, 2024 · 1 comment
Closed

EuiDataGrid not change theme with EuiProvider colorTheme #7990

hieunv2011 opened this issue Aug 29, 2024 · 1 comment
Labels
answered Issues answered by the EUI team - auto-closes open issues in 7 days if no follow-up response known issue

Comments

@hieunv2011
Copy link

hieunv2011 commented Aug 29, 2024

EuiDataGrid not change theme with EuiProvider colorTheme

The DataGrid background not change like text inside

My Code

import { useEffect, useState } from "react";
import {
  EuiPageSidebar,
  EuiPage,
  EuiProvider,
  EuiPageBody,
  EuiBottomBar,
  EuiHideFor,
  EuiPageTemplate,
  EuiPageSection,
  EuiPageHeader,
  EuiDataGrid,
  EuiButtonIcon,
  EuiThemeProvider,
} from "@elastic/eui"
import "@elastic/eui/dist/eui_theme_light.css";
import "@elastic/eui/dist/eui_theme_dark.css";
const data = [
  { id: 1, name: "Alice", age: 25, email: "[email protected]" },
  { id: 2, name: "Bob", age: 30, email: "[email protected]" },
  { id: 3, name: "Charlie", age: 35, email: "[email protected]" },
  { id: 4, name: "David", age: 40, email: "[email protected]" },
];

// Define the columns for the data grid
const columns = [
  { id: "id", displayAsText: "ID" },
  { id: "name", displayAsText: "Name" },
  { id: "age", displayAsText: "Age" },
  { id: "email", displayAsText: "Email" },
];
const Layout = () => {
  const [darkMode, setDarkMode] = useState(true);
  return (
    <EuiProvider colorMode="dark">
      <EuiDataGrid
        aria-label="Sample Data Grid"
        columns={columns}
        columnVisibility={{
          visibleColumns: columns.map((col) => col.id),
          setVisibleColumns: () => {},
        }}
        rowCount={data.length}
        renderCellValue={({ rowIndex, columnId }) => data[rowIndex][columnId]}
      />
    </EuiProvider>
  );
};
export default Layout;

Demo Video
https://github.com/user-attachments/assets/e5d99248-768f-4393-b8ba-2e916925d289

@cee-chen
Copy link
Member

EuiDataGrid has not been converted to Emotion yet and is still on Sass, and will not yet respond to EuiProvider theme customizations. Please track #6394 for that work.

@cee-chen cee-chen closed this as not planned Won't fix, can't repro, duplicate, stale Aug 29, 2024
@cee-chen cee-chen added answered Issues answered by the EUI team - auto-closes open issues in 7 days if no follow-up response known issue and removed accessibility labels Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered Issues answered by the EUI team - auto-closes open issues in 7 days if no follow-up response known issue
Projects
None yet
Development

No branches or pull requests

2 participants