# useGridExport

Hook for programmatic export control.

Must be used within a DataGrid component tree with the export feature enabled.

```ts
useGridExport(selector: string): ExportMethods
```

## Parameters

| Name | Type | Description |
| ---- | ---- | ----------- |
| `selector` | <code>string</code> | Optional CSS selector to target a specific grid element via
  DOM query instead of using React context. Use when the component contains
  multiple grids, e.g. `'tbw-grid.primary'` or `'#my-grid'`. |

#### Example

```tsx
import { useGridExport } from '@toolbox-web/grid-react/features/export';

function ExportToolbar() {
  const { exportToCsv, exportToExcel, exportToJson, isExporting } = useGridExport();

  return (
    <div>
      <button onClick={() => exportToCsv()} disabled={isExporting()}>CSV</button>
      <button onClick={() => exportToExcel()} disabled={isExporting()}>Excel</button>
      <button onClick={() => exportToJson()} disabled={isExporting()}>JSON</button>
    </div>
  );
}
```
