Column Hiding Feature Guide
The column hiding feature is enabled by default and allows the user to hide data columns from either the column actions menu or the columns menu.
Relevant Table Options
# | Prop Name | Type | Default Value | More Info Links | |
---|---|---|---|---|---|
1 | MRT Column Hiding Docs | ||||
2 | TanStack Table Column Visibility Docs | ||||
Relevant Column Options
Relevant State
# | State Option | Type | Default Value | More Info Links | |
---|---|---|---|---|---|
1 | TanStack Table Column Visibility Docs | ||||
Hide Columns by Default
You can easily hide columns by default by setting the
columnVisibility
state
or initialState
to hide the desired columns by id.Disable Column Hiding
If you do not want this feature to be enabled at all, you can disable it by setting the
enableHiding
prop to false
.Alternatively, you can disable hiding specific columns by setting the
enableHiding
column option to false
per column.If you want to hide certain columns by default, you can specify an column visibility in the
initialState.columnVisibility
prop. This can also be useful for making the column hiding state persistent.First Name | Last Name | City | State |
---|---|---|---|
Dylan | Murray | East Daphne | Kentucky |
Raquel | Kohler | Columbus | Ohio |
Ervin | Reinger | South Linda | West Virginia |
Brittany | McCullough | Lincoln | Nebraska |
Branson | Frami | Charleston | South Carolina |
1-5 of 5
Enable Column Hiding on Display Columns
By default, column hiding is only enabled on data columns. Display columns, such as
mrt-row-numbers
, mrt-row-select
, etc., do not have column hiding enabled, and their toggle will be disabled. You can turn that back on by setting the enableHiding
option to true
in the displayColumnsOptions
prop.See the Display Columns Feature Guide for a more in depth explanation of the
displayColumnsOptions
prop.View Extra Storybook Examples