Join our Discord Community
Tables

👋 This is a community-driven shadcn/ui resource. For the official documentation, visit ui.shadcn.com

Table with Density Toggle

Data table with density toggle allowing users to switch between compact, comfortable, and spacious row spacing modes

Looking to implement shadcn/ui blocks?

Join our Discord community for help from other developers.


Working with dense datasets or prefer breathing room? This React table includes a density toggle letting users switch between compact (minimal padding), comfortable (balanced), and spacious (generous whitespace) modes. Built with shadcn/ui Table and ToggleGroup components, the toggle buttons in the top-right corner instantly adjust row heights and cell padding across the entire table. User preference persists in state—perfect for dashboards where power users want maximum density while casual users prefer comfortable spacing, or data grids where different tasks benefit from different layouts.

Loading preview...

Installation

npx shadcn@latest add https://www.shadcn.io/registry/table-density-01.json
npx shadcn@latest add https://www.shadcn.io/registry/table-density-01.json
pnpm dlx shadcn@latest add https://www.shadcn.io/registry/table-density-01.json
bunx shadcn@latest add https://www.shadcn.io/registry/table-density-01.json

Questions you might have