Column Pinning Feature Guide
Column pinning is a cool feature that lets users pin (freeze) columns to the left or right of the table. Pinned columns will not scroll horizontally with the rest of the columns so that they always stay visible to the user.
Relevant Table Options
# | Prop Name | Type | Default Value | More Info Links | |
---|---|---|---|---|---|
1 | boolean |
| |||
2 | OnChangeFn<ColumnPinningState> |
| TanStack Table Column Pinning Docs | ||
Relevant Column Options
# | Column Option | Type | Default Value | More Info Links | ||
---|---|---|---|---|---|---|
No records to display | ||||||
Relevant State
# | State Option | Type | Default Value | More Info Links | |
---|---|---|---|---|---|
1 | { left: Array<string>, right: Array<string> } | { left: [], right: [] } | TanStack Table Column Pinning Docs | ||
Enable Column Pinning
Column pinning can simply be enabled by setting the enableColumnPinning
table option to true
.
Pin (Freeze) Columns By Default
Columns can start out pinned in your table by setting the columnPinning
states in either initialState
or state
.
Column Pinning Example
State | ID | First Name | Middle Name | Last Name | Address | City |
---|---|---|---|---|---|---|
Kentucky | 1 | Dylan | Sprouse | Murray | 261 Erdman Ford | East Daphne |
Ohio | 2 | Raquel | Hakeem | Kohler | 769 Dominic Grove | Columbus |
West Virginia | 3 | Ervin | Kris | Reinger | 566 Brakus Inlet | South Linda |
Nebraska | 4 | Brittany | Kathryn | McCullough | 722 Emie Stream | Lincoln |
South Carolina | 5 | Branson | John | Frami | 32188 Larkin Turnpike | Charleston |