# DataGridGrouping (@salmonui/data-grid)

> The DataGridGrouping interface of @salmonui/data-grid: grouping prop.

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

```ts
import type { DataGridGrouping } 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 DataGridGrouping<Row> {
    readonly groupBy?: readonly string[];
    readonly showDropArea?: boolean;
    readonly showGroupedColumns?: boolean;
    readonly showHeaderToggle?: boolean;
    readonly showRemoveButton?: boolean;
    readonly reorderable?: boolean;
    readonly defaultExpanded?: boolean;
    readonly lazy?: boolean;
    readonly lazyChunkSize?: number;
    readonly renderCaption?: (ctx: DataGridGroupCaptionContext<Row>) => ReactNode;
}
```

`grouping` prop.

Members (10):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `groupBy` | `readonly groupBy?: readonly string[];` | optional | Grouped fields in order. Reactive. Group order follows `sorting.sortBy` for the field, else ascending. |
| `showDropArea` | `readonly showDropArea?: boolean;` | optional | Group drop area above the header. Default true. |
| `showGroupedColumns` | `readonly showGroupedColumns?: boolean;` | optional | Keep grouped columns visible. Default false. |
| `showHeaderToggle` | `readonly showHeaderToggle?: boolean;` | optional | Group toggle button (`aria-pressed`) in the header of every groupable column: groups or ungroups by it. Default false. The sort-direction toggle on group chips has no option: it follows `sorting` (shown when the grid sorts and the column is sortable). |
| `showRemoveButton` | `readonly showRemoveButton?: boolean;` | optional | Remove button on group chips. Default true. |
| `reorderable` | `readonly reorderable?: boolean;` | optional | Reorder group chips by drag and Alt+Arrow keys. Default false. |
| `defaultExpanded` | `readonly defaultExpanded?: boolean;` | optional | Groups start expanded. Default true (false in lazy mode). |
| `lazy` | `readonly lazy?: boolean;` | optional | Lazy group loading with a remote source that has `capabilities.lazyGroups`. |
| `lazyChunkSize` | `readonly lazyChunkSize?: number;` | optional | Lazy mode: child rows per load. Default 100. |
| `renderCaption` | `readonly renderCaption?: (ctx: DataGridGroupCaptionContext<Row>) => ReactNode;` | optional | Replaces the caption text; the toggle stays. |
