# useGridExport

Composable for programmatic export control.

Must be used within a component that contains a TbwGrid 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 Vue's provide/inject. Use when the component
  contains multiple grids, e.g. `'tbw-grid.primary'` or `'#my-grid'`. |

#### Example

```vue
<script setup>
import { useGridExport } from '@toolbox-web/grid-vue/features/export';

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

async function handleExport(format: 'csv' | 'excel' | 'json') {
  if (isExporting()) return; // Prevent concurrent exports

  switch (format) {
    case 'csv': exportToCsv('data.csv'); break;
    case 'excel': exportToExcel('data.xlsx'); break;
    case 'json': exportToJson('data.json'); break;
  }
}
</script>
```
