# useGrid

> _Since v0.1.0_

Composable for programmatic access to the grid.

```ts
useGrid(selector: string): UseGridReturn<TRow>
```

## 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 { useGrid } from '@toolbox-web/grid-vue';

const { forceLayout, getConfig, isReady, getVisibleColumns } = useGrid();

async function handleResize() {
  await forceLayout();
}
</script>
```
