# useGridPrint

Hook for programmatic print control.

Must be used within a DataGrid component tree with print enabled.

```ts
useGridPrint(selector: string): PrintMethods
```

## 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 { useGridPrint } from '@toolbox-web/grid-react/features/print';

function PrintToolbar() {
  const { print, isPrinting } = useGridPrint();

  const handlePrint = async () => {
    await print({ title: 'My Report', isolate: true });
    console.log('Print dialog closed');
  };

  return (
    <button onClick={handlePrint} disabled={isPrinting()}>
      {isPrinting() ? 'Printing...' : 'Print Report'}
    </button>
  );
}
```
