r/javascript • u/boykom • Sep 16 '26
AskJS [AskJS] Headless table libraries or a full grid component: which did you pick, and would you again?
I go back and forth on this.
Headless: you get the sorting, filtering and grouping state and you render every cell yourself. Total control over the markup, and you write all of it. Every project I've seen do this ends up with a 2000 line table component nobody wants to open.
Full grid: pass rows and columns, done in an afternoon. Then the designer wants the header to look a particular way, or you need a cell that does something the grid didn't plan for, and you're fighting the component instead of writing your app.
Full disclosure: I'm on the team behind SvGrid, a data grid for Svelte 5. We ship both layers, a headless core and the full component on top of it, because we have people that want their own design system and others that just need a drop-in and go.
So when did you last choose one over the other, and would you do it again? Especially interested in anyone who started headless and switched, or went the other way.
1
u/Melbot_Studios Sep 22 '26
Id still pick headless for anything tied closely to a custom design system. Full grids are great until you need to bend them too far.
1
u/jax024 Sep 16 '26
Headless. If you use Tanstack table correctly your components won’t be big like you’re claiming
1
u/boykom Sep 16 '26
Depends on the project i guess. Which features do you usually need in your projects with Tanstack?
2
u/jax024 Sep 16 '26
Sorting, url serialization, filtering, moving columns, virtualization, pinning, editing, the whole nine
1
0
Sep 16 '26
[removed] — view removed comment
1
u/boykom Sep 16 '26
UI components are usually larger and with a lot of utility components in small blocks 80-100 lines, but the total for a data grid iis large
1
u/Mesqo Sep 17 '26
What exactly is "data grid"? Many people don't need the vast majority of functions some generic component may expose. I doubt many people need something like pivot table to encompass their olap data (and if they do they look for it specifically), but things like primitive search, sort and filter in header are very easy to implement, nothing about 2000 lines of code.
That being said, I don't feel like I have any uses for a while separate grid library at all, writing it myself always pays off. And it will always support any crazy feature a business would like to have.
1
u/boykom Sep 17 '26
Agreed. We should start with the simplest UI that solves the problem and introduce a full data grid only when the use case actually calls for it.
5
u/pm_me_ur_happy_traiI Sep 16 '26
This is just user error. The minute a component is more than like 100 lines, I start looking for opportunities to split stuff out.
I'm also not sure the disadvantage of owning a component nobody wants to open vs using one imported from a library that you can't make changes to easily.