# DataGridBeforePasteEvent (@salmonui/data-grid)

> The DataGridBeforePasteEvent interface of @salmonui/data-grid: onBeforePaste: preventDefault() cancels, assigning data changes the pasted text.

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

```ts
import type { DataGridBeforePasteEvent } 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 DataGridBeforePasteEvent extends DataGridEvent {
    data: string;
    readonly target: DataGridClipboardCell | null;
}
```

`onBeforePaste`: `preventDefault()` cancels, assigning `data` changes the pasted text.

Members (6):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `data` | `data: string;` |  | The clipboard text (TSV). Assign to change what is pasted. |
| `target` | `readonly target: DataGridClipboardCell \| null;` |  | Top-left target cell: the selected range's top-left cell, else the focused cell; null without a target. |
| `type` | `type: string;` | inherited | `'sortChange'`, `'beforeSortChange'`, ... |
| `source` | `source: DataGridEventSource;` | inherited |  |
| `defaultPrevented` | `defaultPrevented: boolean;` | inherited | True after `preventDefault()` (before-events and click events). |
| `preventDefault` | `preventDefault: () => void;` | inherited | Before-events and click events: cancels the action (or the built-in behavior). |
