# SelectionConfig

> _Since v0.1.1_

Configuration options for the selection plugin *

## Properties

| Property | Type | Description |
| -------- | ---- | ----------- |
| `mode` | <code><a href="/grid/plugins/selection/types/selectionmode/">SelectionMode</a> &#124; <a href="/grid/plugins/selection/types/selectionmode/">SelectionMode</a>[]</code> | Selection mode (default: `'cell'`). |
| `multiSelect?` | <code>boolean</code> | Allow multiple items to be selected simultaneously (default: true). |
| `enabled?` | <code>boolean</code> | Whether selection is enabled (default: true). |
| `triggerOn?` | <code><a href="/grid/plugins/selection/types/selectiontrigger/">SelectionTrigger</a></code> | Mouse event type that triggers selection (default: 'click'). |
| `checkbox?` | <code>boolean</code> | Show a checkbox column for row selection (row mode only). |
| `isSelectable?` | <code><a href="/grid/plugins/selection/types/selectablecallback/">SelectableCallback</a>&lt;T&gt;</code> | Callback that determines whether a specific row or cell can be selected. |

### Property Details

#### multiSelect

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`

```ts
// 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 })
```

---

#### enabled

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`

```ts
// Disable selection at runtime
new SelectionPlugin({ mode: 'row', enabled: false })

// Toggle via gridConfig
grid.gridConfig = { ...grid.gridConfig, selectable: false };
```

---

#### checkbox

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`

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

---

#### isSelectable

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

```ts
// 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',
})
```

---
