# DataGridColumnChooserContext (@salmonui/data-grid)

> The DataGridColumnChooserContext interface of @salmonui/data-grid: Context of columnChooser.renderChooser, renderHeader, and renderFooter.

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

```ts
import type { DataGridColumnChooserContext } 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 DataGridColumnChooserContext<Row = unknown> {
    readonly columns: readonly DataGridColumnChooserItem<Row>[];
    readonly searchText: string;
    setSearchText(text: string): void;
    setHidden(fields: string | readonly string[], hidden: boolean): void;
    apply(): void;
    close(): void;
    readonly defaultContent: ReactNode;
}
```

Context of `columnChooser.renderChooser`, `renderHeader`, and `renderFooter`.

Members (7):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `columns` | `readonly columns: readonly DataGridColumnChooserItem<Row>[];` |  | Hideable leaf columns in definition order. |
| `searchText` | `readonly searchText: string;` |  | Current search text (empty without `searchable`). |
| `setSearchText` | `setSearchText(text: string): void;` |  |  |
| `setHidden` | `setHidden(fields: string \| readonly string[], hidden: boolean): void;` |  | Updates the draft visibility (immediate mode applies it at once). At least one column stays visible. |
| `apply` | `apply(): void;` |  | Applies the draft and closes (the OK button). |
| `close` | `close(): void;` |  | Discards the draft and closes. |
| `defaultContent` | `readonly defaultContent: ReactNode;` |  | The built-in content the render prop replaces (search box and list, or the OK / Cancel buttons). |
