Skip to content

SelectionConfig

Configuration options for the selection plugin

PropertyTypeDescription
modeSelectionModeSelection mode (default: ‘cell’)
multiSelect?booleanAllow multiple items to be selected simultaneously (default: true).
enabled?booleanWhether selection is enabled (default: true).
triggerOn?SelectionTriggerMouse event type that triggers selection (default: ‘click’).
checkbox?booleanShow a checkbox column for row selection (row mode only).
isSelectable?SelectableCallback<T>Callback that determines whether a specific row or cell can be selected.

Allow multiple items to be selected simultaneously (default: true).

When false:

  • Row mode: Only one row can be selected at a time. Ctrl+Click and Shift+Click behave like plain clicks (select only the clicked row). “Select all” is disabled.
  • Range mode: Only one range exists at a time. Ctrl+Click starts a new range instead of adding to existing ranges.
  • Cell mode: No effect (cell mode is always single-cell).

Checkbox behavior when multiSelect: false:

  • Header “select all” checkbox is hidden
  • Row checkboxes replace the current selection instead of toggling

Default: true

// Single row selection only
new SelectionPlugin({ mode: 'row', multiSelect: false })
// Single row with checkbox (no "select all" in header)
new SelectionPlugin({ mode: 'row', multiSelect: false, checkbox: true })

Whether selection is enabled (default: true).

When false, disables all selection interactions while keeping the plugin loaded. Useful for temporarily disabling selection without removing the plugin.

Default: true

// Disable selection at runtime
new SelectionPlugin({ mode: 'row', enabled: false })
// Toggle via gridConfig
grid.gridConfig = { ...grid.gridConfig, selectable: false };

Show a checkbox column for row selection (row mode only).

When true and mode is 'row', adds a narrow utility column with checkboxes:

  • Row checkboxes: Click to toggle individual row selection
  • Header checkbox: Click to select/deselect all rows
  • Indeterminate state shown when some (but not all) rows are selected

Checkboxes work with Shift+Click (range select) and follow isSelectable rules.

Default: false

new SelectionPlugin({ mode: 'row', checkbox: true })

Callback that determines whether a specific row or cell can be selected.

Non-selectable rows/cells:

  • Don’t respond to click/keyboard selection
  • Are excluded from “select all” operations
  • Have visual indicator (muted styling via [data-selectable="false"])
  • Remain focusable for navigation
// Prevent selection of locked rows
new SelectionPlugin({
mode: 'row',
isSelectable: (row) => row.status !== 'locked',
})
// Prevent selection of specific columns (cell/range mode)
new SelectionPlugin({
mode: 'cell',
isSelectable: (row, rowIndex, col) => col?.field !== 'id',
})

AI assistants: For complete API documentation, implementation guides, and code examples for this library, see https://raw.githubusercontent.com/OysteinAmundsen/toolbox/main/llms-full.txt