TanStackT
TanStack2y ago
11 replies
dry-scarlet

Auto Column Size

How can I have auto/dynamic/fit-content column sizes instead of fix sized column sizes? So the column fits the size of its content (all cells in the column). It doesn't have to work with column resizing.

I'm basing of this example, which has a sticky header, making this slightly more 'complicated'. Though, this should be an essential feature for TanStack Table, I simply haven't found it in the docs.
https://tanstack.com/table/v8/docs/framework/react/examples/virtualized-rows

No mentions about this in the columns sizing guide:
https://tanstack.com/table/v8/docs/guide/column-sizing

I've also stumbled on this GitHub issue, but it provides a solution that does not work with a sticky header, and provides only other hacky solutions:
https://github.com/TanStack/table/discussions/3192

Is there not a simple, non-hacky way to achieve this essential feature for a table?

Thanks
Was this page helpful?