chanzuckerberg / sci-components

2021 Science Design System Component Library
https://chanzuckerberg.github.io/sci-components/
MIT License
25 stars 7 forks source link

Striped row table support #889

Open lanesawyer opened 1 week ago

lanesawyer commented 1 week ago

Feature Request

A stripedRows prop on the TableBody that applies striping.

Our Situation

We did our own striping (using nth-of-type(odd) CSS selector on the table body's styled component) but that ends up having has higher CSS specificity than the TableRow component itself. That worked fine enough but now we wanted allow for table row selection. Due to our CSS styling on the table, the selected style applied by the TableRow selected prop doesn't show up, as the striping is taking priority.

We've fixed it by applying the styling that the selected prop applies to the row ourselves directly on the component so that the CSS specificity is higher than our striping on the TableBody, but it would be nice if we could simply use the selected prop and a library-provided striping.