Compositions
DataGridColumnVisibility
Dropdown of checkbox items that show/hide the hideable columns of a TanStack
Table.
Only lists columns with an accessor that report getCanHide(), labelling
each from columnDef.meta.headerTitle (falling back to the column id).
Toggling a column keeps the menu open so several can be flipped at once.
Usage
Best practices
Pass the TanStack
tableinstance directly (this part does NOT read DataGrid context) plus atriggerelement rendered viarender- supply your ownButton, it renders none.Only accessor columns reporting
getCanHide()appear; setenableHiding: falseon a column def to keep it always-visible and out of this menu.Label each column via
columnDef.meta.headerTitle- the menu falls back to the raw columnidwhen it's missing.
Props
Composition
Builds on