# Shadcn Row Pinning

> Data grid with row pinning support

- Type: example, free and open source (MIT)
- Component: [Data Grid](https://reui.io/components/data-grid.md)
- Page: https://reui.io/components/data-grid/c-data-grid-29
- Docs (Base UI): https://reui.io/docs/components/base/data-grid.md
- Docs (Radix UI): https://reui.io/docs/components/radix/data-grid.md
- MCP: `get_example("c-data-grid-29")`
- Registry item: https://reui.io/r/styles/base-nova/c-data-grid-29.json
- Uses: Avatar, Badge, Button, Card, Data Grid, Dropdown Menu

## Best for

Rows pinned above the rest from a pin column or row menu, kept across pages with a count and Unpin all

## Agent notes

- `keepPinnedRows` keeps pinned rows visible on every page; set it false to show a pin only on its own page
- Only the pin and Copy ID entries in `ActionsCell` act; Edit, Delete and the refresh `Button` have no handlers

## When not to use

- Rows marked for a bulk action without changing their position: use [Row Selection](https://reui.io/components/data-grid/c-data-grid-7.md) (`get_example("c-data-grid-7")`)

## Third-party libraries

- TanStack Table v9: [API reference](https://tanstack.com/table/v9/docs/framework/react/reference/index), [docs](https://tanstack.com/table/v9/docs/framework/react/quick-start)
- Sonner v2: [API reference](https://sonner.emilkowal.ski/toast), [docs](https://sonner.emilkowal.ski/getting-started)

## Install

```bash
npx shadcn@latest add @reui/c-data-grid-29
```

## About Shadcn Data Grid

### When to use

- Admin and back office tables that sort, filter, paginate and select rows
- Spreadsheet style editing with cell selection, clipboard and inline edits
- Large record sets that need virtualized rows, columns or infinite scroll

### When not to use

- A short static list of rows with no sorting or paging: use [Table](https://reui.io/components/table.md) (`get_component("table")`)
- Records moved as cards between status columns: use [Kanban](https://reui.io/components/kanban.md) (`get_component("kanban")`)
- A folder or category hierarchy with no columns of data: use [Tree](https://reui.io/components/tree.md) (`get_component("tree")`)

### Agent notes

- With `manualPagination`, pass the server total to `useTable` as `rowCount` as well as `recordCount`, or the page buttons never render
- Give `useTable` a stable `getRowId` whenever rows can be pinned, reordered or virtualized
- Swap `DataGridTable` for `DataGridTableVirtual` when rows need virtualization or infinite scroll

Every ReUI item has a twin like this one; the index is https://reui.io/llms.txt. Agents with the ReUI MCP (https://reui.io/docs/mcp) get the same guidance from the getters named above.
