jbetancur / react-data-table-component

A responsive table library with built-in sorting, pagination, selection, expandable rows, and customizable styling.
https://react-data-table-component.netlify.app
Apache License 2.0
2.05k stars 413 forks source link

[DESCRIPTION] Trying to override rdt_TableHeader and other pre defined styles but it is not working. #1101

Closed BinduManjunatha1 closed 1 year ago

BinduManjunatha1 commented 2 years ago

I'm trying to apply background color to rdt_TableHeader but it is not applied. Can someone pls suggest what I'm doing incorrectly?

Styled.css export const ReactDataTable = styled(DataTable) .rdt_TableHeadRow { background-color: gray; } ;

export const Expandable = () => { return ( <ReactDataTable columns={columns} data={data} expandableRows expandOnRowClicked highlightOnHover striped pointerOnHover expandableRowsComponent={ExpandedComponent} /> ); }; ![background color not applied](https://user-images.githubusercontent.com/95225875/185432802-f6874990-2e93-4052-99e4-58417349389a.jpg)

lucccar commented 2 years ago

I've found that css overriding is a bit inconsistent. Something that sometimes works is to make a style for the rdt_ class alongside the table classname you create, like:

.dataTableComponent, .rdt_TableHeader {
    // your style here
}

where dataTableComponent is the class name I've putted in the DataTable component:

<DataTable
      className={styles.dataTableComponent}
      columns={columns}
      data={data}
      {...props}
    />
stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.