Table Column Setup

The TableColumnSetup component provides a user interface for configuring table column visibility and order. It displays a button that opens a popup with a list of available columns, allowing users to show/hide columns and optionally reorder them via drag and drop.

import {TableColumnSetup} from '@gravity-ui/uikit';

Sortable columns

Enable drag and drop functionality to allow users to reorder columns by setting the sortable property to true.

Apply modes

Control when changes are applied using the hideApplyButton property:

  • true - Changes are applied immediately when user toggles columns
  • false - Changes are applied only when user clicks the Apply button

Status display

Show the count of selected columns in the switcher button by enabling the showStatus property.

Custom switcher

Customize the trigger button using the renderSwitcher property.

Properties

NameDescriptionTypeDefault
itemsArray of column configuration itemsTableColumnSetupItem[]
onUpdateCallback fired when column configuration changes(items: TableColumnSetupItem[]) => void
disabledDisables the switcher buttonbooleanfalse
sortableEnables drag and drop sorting of columnsbooleantrue
hideApplyButtonWhen to apply changes: immediately or manually via Apply buttonbooleanfalse
showStatusShows selected/total columns count in switcher buttonbooleanfalse
popupWidthWidth of the popupnumber | 'fit'
popupPlacementPopup placement relative to triggerPopupPlacement
renderSwitcherCustom render function for the switcher button(props: SwitcherProps) => React.ReactElement | undefined
switcherDeprecated. Use renderSwitcher insteadReact.ReactElement | undefined
getItemTitleFunction to get item title(item: TableColumnSetupItem) => React.ReactNode
classNameCustom CSS class for the root elementstring

TableColumnSetupItem

NameDescriptionTypeDefault
idUnique identifier for the columnstring
titleDisplay title for the columnReact.ReactNode
selectedWhether the column is currently visibleboolean
requiredWhether the column is required (cannot be hidden)boolean
stickySticky positioning for the column'left' | 'right'

SwitcherProps

NameDescriptionType
onClickClick event handler for the switcherReact.MouseEventHandler<HTMLElement>
onKeyDownKeyDown event handler for the switcherReact.KeyboardEventHandler<HTMLElement>