Skip to content

Extracting table styles... to somewhere? #2691

Discussion options

You must be logged in to vote

Hi Martin!

I would have suggested the component route for that. But if you feel like plain old CSS is the best tool for the job, it might be!

You could use @apply to compose utilities together for your table, th, tr etc to keep your styling consistent with the rest of the UI.

I would personally (especially if using React/Vue/Svelte/xxx) create a Table component which maybe also exports a Row and Cell components (and head, body, whatever you need), so you can compose your tables with a lot of flexibility and style the component in one place.

There is no right or wrong answer with using CSS vs abstracting a component - just a set of trade-offs between both approach you need to evaluate, and…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@MartinHughes-BPC
Comment options

Answer selected by MartinHughes-BPC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants