Column visibility state is stored on the table using the following shape:
export type VisibilityState = Record<string, boolean>
export type VisibilityTableState = {
columnVisibility: VisibilityState
}export type VisibilityState = Record<string, boolean>
export type VisibilityTableState = {
columnVisibility: VisibilityState
}enableHiding?: booleanenableHiding?: booleanEnables/disables hiding the column
getCanHide: () => booleangetCanHide: () => booleanReturns whether the column can be hidden
getIsVisible: () => booleangetIsVisible: () => booleanReturns whether the column is visible
toggleVisibility: (value?: boolean) => voidtoggleVisibility: (value?: boolean) => voidToggles the column visibility
getToggleVisibilityHandler: () => (event: unknown) => voidgetToggleVisibilityHandler: () => (event: unknown) => voidReturns a function that can be used to toggle the column visibility. This function can be used to bind to an event handler to a checkbox.
onColumnVisibilityChange?: OnChangeFn<VisibilityState>onColumnVisibilityChange?: OnChangeFn<VisibilityState>If provided, this function will be called with an updaterFn when state.columnVisibility changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table.
enableHiding?: booleanenableHiding?: booleanEnables/disables hiding of columns.
getVisibleFlatColumns: () => Column<TData>[]getVisibleFlatColumns: () => Column<TData>[]Returns a flat array of columns that are visible, including parent columns.
getVisibleLeafColumns: () => Column<TData>[]getVisibleLeafColumns: () => Column<TData>[]Returns a flat array of leaf-node columns that are visible.
getLeftVisibleLeafColumns: () => Column<TData>[]getLeftVisibleLeafColumns: () => Column<TData>[]If column pinning, returns a flat array of leaf-node columns that are visible in the left portion of the table.
getRightVisibleLeafColumns: () => Column<TData>[]getRightVisibleLeafColumns: () => Column<TData>[]If column pinning, returns a flat array of leaf-node columns that are visible in the right portion of the table.
getCenterVisibleLeafColumns: () => Column<TData>[]getCenterVisibleLeafColumns: () => Column<TData>[]If column pinning, returns a flat array of leaf-node columns that are visible in the unpinned/center portion of the table.
setColumnVisibility: (updater: Updater<VisibilityState>) => voidsetColumnVisibility: (updater: Updater<VisibilityState>) => voidUpdates the column visibility state via an updater function or value
resetColumnVisibility: (defaultState?: boolean) => voidresetColumnVisibility: (defaultState?: boolean) => voidResets the column visibility state to the initial state. If defaultState is provided, the state will be reset to {}
toggleAllColumnsVisible: (value?: boolean) => voidtoggleAllColumnsVisible: (value?: boolean) => voidToggles the visibility of all columns
getIsAllColumnsVisible: () => booleangetIsAllColumnsVisible: () => booleanReturns whether all columns are visible
getIsSomeColumnsVisible: () => booleangetIsSomeColumnsVisible: () => booleanReturns whether some columns are visible
getToggleAllColumnsVisibilityHandler: () => ((event: unknown) => void)getToggleAllColumnsVisibilityHandler: () => ((event: unknown) => void)Returns a handler for toggling the visibility of all columns, meant to be bound to a input[type=checkbox] element.
getVisibleCells: () => Cell<TData>[]getVisibleCells: () => Cell<TData>[]Returns an array of cells that account for column visibility for the row.