TanStackT
TanStack6d ago
4 replies
sacred-rose

How can I make a column header just span? (colspan)

This has been asked many times before but never in the way I need it.
The React kitchen sink example ends up creating multiple headers rows, which is not what I need to do.

All I want to do is this:
|  Column Header  |
|=================|
|  Cell  |  Cell  |

So there would be 2 column definitions but one column header is spanning 2 cells and the second column header is not rendered (just like you can do with colspan="2" in HTML attributes directly).

One of the answers on a previous thread was that if the columns are static, one can just bypass Tanstack Table and create them manually.

But in my case, I don't want to bypass Tanstack Table so I can keep using all the other column features, even if I can't access them for the second column that doesn't have it's own header.

Any ideas?
Was this page helpful?