Different colour for react-table headers

Viewed 700

Having trouble with styling table created by react-table library.

Please find the design below. enter image description here

Table is created the way it is shown in documentation. Is it possible to colour headers as shown in design?

Thank you in advance

P.S. Here is the code snippet from documentation enter image description here

To create headers I need to create an array. So i cant change style for a specific header (actually I can provide element to render, but it will be rendered inside the element)

3 Answers

Check this, there are class names added to the data where the data should be styled differently. I think that's what you need.

Had to use a workaround. As Taha Jamil mentioned you can any JSX to render inside of the Header. By adjusting some styles you will get something like this:

{
  Header: () => {
    return(
      <div
        style={{
          backgroundColor: "red",
          position: "absolute",
          width: "100%",
          height: "100%",
          top: "0px",
          left: "0px",
          padding: "12px 20px",
        }}
      >
        Title
      </div>
    );
  }
}

enter image description here

Not the best solution, but works

Related