# DataGridPersistState (@salmonui/data-grid)

> The DataGridPersistState interface of @salmonui/data-grid: persistState settings.

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

```ts
import type { DataGridPersistState } 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 DataGridPersistState {
    readonly key?: string;
    readonly storage?: DataGridStateStorageAdapter;
    readonly exclude?: readonly DataGridStatePart[];
    readonly version?: number;
    readonly migrate?: (state: Record<string, unknown>, version: number) => DataGridState | null;
}
```

`persistState` settings.

Members (5):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `key` | `readonly key?: string;` | optional | Storage key. Default `salmon-data-grid:<id>` (the grid `id` prop is then required). |
| `storage` | `readonly storage?: DataGridStateStorageAdapter;` | optional | Storage with `load` / `save` / `remove` (sync or async), for example `@salmonui/data` `createKeyValueStateStorage`. Default: `localStorage`, read only in the browser after mount. |
| `exclude` | `readonly exclude?: readonly DataGridStatePart[];` | optional | State parts that are not saved or restored. |
| `version` | `readonly version?: number;` | optional | Application state version. A stored state saved under another version is discarded unless `migrate` upgrades it. |
| `migrate` | `readonly migrate?: (state: Record<string, unknown>, version: number) => DataGridState \| null;` | optional | Upgrades a stored state of another schema or application version; return null to discard it. |
