komarovalexander / ka-table

Lightweight MIT React Table component with Sorting, Filtering, Grouping, Virtualization, Editing and many more
http://ka-table.com
MIT License
769 stars 56 forks source link

question: how can we override a row's height to a smaller size? #440

Closed diogoparente closed 1 week ago

diogoparente commented 1 week ago

Hey @komarovalexander πŸ‘‹

I see that ka-table is forcing a default cell height, which I can only override by setting the value to a bigger value, otherwise it does not apply whatsoever.

Is there a way to do so?

I've already tried to define a custom override.scss and try to assign a different value to $ka-header-cell-height, but it still didn't work.

Shouldn't we be able to specify a <tr> and <thead/> height through props?

Thank you for such a flexible OSS table!

komarovalexander commented 1 week ago

Hi @diogoparente looks like you need to override paddings as well ($ka-thead-cell-padding) demo: https://stackblitz.com/edit/table-custom-theme-ts-ur2pni?file=dark.scss

Shouldn't we be able to specify a and height through props?

you can do it by elementAttributes in childComponents.headCell, but I would recommend to override default styles in scss

diogoparente commented 1 week ago

Thanks for the quick help, @komarovalexander!

Your example works really well, but unfortunately, we are wrapping ka-table in a styled-components container to target specific sections, so we can’t go down that route.

The closest solution I can think of is creating multiple .scss files with the specific variant rules, then having an override.scss file with classes that apply those rules and conditionally choose the correct class.

This would require us to adjust our approach to styling, which may lead to changes in the design requirements rather than the styling method.

I appreciate your time and help! πŸ™‡β€β™‚οΈ