# DataGridSelection (@salmonui/data-grid)

> The DataGridSelection interface of @salmonui/data-grid: selection prop. Selection is on by default (single row).

Canonical: https://salmonui.dev/docs/reference/data-grid/DataGridSelection

```ts
import type { DataGridSelection } from '@salmonui/data-grid';
```

Entry index: https://salmonui.dev/docs/reference/data-grid (Markdown with every symbol of the entry: https://salmonui.dev/docs/reference/data-grid.md).

## Reference

Kind: interface

```ts
interface DataGridSelection {
    readonly multiple?: boolean;
    readonly mode?: 'row' | 'cell' | 'both';
    readonly cellRange?: 'flow' | 'box' | 'boxWithBorder';
    readonly checkboxRowClick?: 'add' | 'replace';
    readonly checkboxOnly?: boolean;
    readonly toggle?: boolean;
    readonly persistent?: boolean;
    readonly additive?: boolean;
    readonly columns?: boolean;
    readonly rowIds?: readonly RowId[];
}
```

`selection` prop. Selection is on by default (single row).

Members (10):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `multiple` | `readonly multiple?: boolean;` | optional | Several rows (or cells). Default false (single). |
| `mode` | `readonly mode?: 'row' \| 'cell' \| 'both';` | optional | Default `row`. |
| `cellRange` | `readonly cellRange?: 'flow' \| 'box' \| 'boxWithBorder';` | optional | Cell range shape. Default `flow`. |
| `checkboxRowClick` | `readonly checkboxRowClick?: 'add' \| 'replace';` | optional | With a `type: 'selection'` column: `add` (default) toggles the clicked row; `replace` selects only it. |
| `checkboxOnly` | `readonly checkboxOnly?: boolean;` | optional | Only the selection column's checkbox selects rows. |
| `toggle` | `readonly toggle?: boolean;` | optional | Clicking the only selected row deselects it. Default true. |
| `persistent` | `readonly persistent?: boolean;` | optional | Keep selection across sort, filter, search, page, and group changes. Default false. |
| `additive` | `readonly additive?: boolean;` | optional | Plain clicks add to the selection (no modifier keys) in multiple mode. |
| `columns` | `readonly columns?: boolean;` | optional | Column selection. |
| `rowIds` | `readonly rowIds?: readonly RowId[];` | optional | Selected row ids. Reactive: a changed value re-applies. |
