Shadcn.io is not affiliated with official shadcn/ui
Shadcn Data Table
React data table component with sorting, filtering, pagination, and row selection. Built with TypeScript and Tailwind CSS for Next.js using TanStack Table.
Ever built an admin dashboard where users complained they couldn't sort the user list? Or watched someone give up on finding data because your table had 500 rows and no search? Yeah, basic HTML tables don't cut it for real applications. This shadcn/ui data table brings spreadsheet-like power to your React apps without the complexity.
Data table showcase
Tables that actually help users find what they need:
Built on TanStack Table—the same library powering tables at Linear, Notion, and other data-heavy applications. Styled with Tailwind CSS so it matches your design system instead of looking like a 2005 DataGrid.
npx shadcn@latest add table
npm install @tanstack/react-tableWhy data tables actually solve user problems
Here's the thing—users don't want to see your data. They want to find specific information, compare values, and take actions. A basic table just dumps everything and hopes users figure it out. Smart tables help users work with data effectively.
Think about how you use GitHub's repository list or Gmail's inbox. You sort by date, filter by status, search for keywords. That's not fancy features—that's basic usability for any data-heavy interface. Users bring these expectations to your app.
This free shadcn data table handles the complex parts—sorting algorithms, filter logic, pagination math, keyboard navigation—while you focus on what actions users need to take. Whether you're building admin panels, analytics dashboards, or user management interfaces in your Next.js applications, tables that respond instantly make users more productive in your JavaScript projects.
Common data table patterns you'll actually use
Basic data display
Clean tabular data without the complexity:
Sortable columns
Click any header to sort—exactly what users expect:
Search and filter
Users need to find specific rows quickly:
Pagination for large datasets
Keep things fast and manageable:
Multi-select with checkboxes
Bulk actions require row selection:
Column visibility controls
Let users customize their view:
Features
This free open source data table component includes everything you need:
- TypeScript-first - Full type safety with TanStack Table integration
- TanStack Table powered - Battle-tested sorting, filtering, and pagination logic
- Flexible columns - Custom cells, sorting, filtering, and visibility controls
- Tailwind CSS styled - Customize with utilities, not fighting component CSS
- Keyboard accessible - Tab navigation, Enter to sort, proper ARIA labels
- Mobile responsive - Horizontal scroll and adaptive column display
- Row selection - Single and multi-select with checkbox controls
- Performance optimized - Virtual scrolling for large datasets
API Reference
Core Components
| Component | Purpose | Key Props |
|---|---|---|
Table | Main container | className for responsive styling |
TableHeader | Column headers | Groups header rows |
TableBody | Data rows | Contains all table content |
TableRow | Individual row | className for selection states |
TableHead | Header cell | className for sorting indicators |
TableCell | Data cell | Custom content rendering |
TanStack Integration
| Hook | Purpose | Key Props |
|---|---|---|
useReactTable | Table instance | data, columns, row models |
getCoreRowModel | Basic functionality | Always required |
getSortedRowModel | Column sorting | Enables clickable headers |
getFilteredRowModel | Search/filter | Global and column filters |
getPaginationRowModel | Page navigation | Handles large datasets |
Column Configuration
const columns: ColumnDef<DataType>[] = [
{
accessorKey: "field", // Data property
header: "Display Name", // Column title
cell: ({ row }) => <CustomCell />, // Custom rendering
enableSorting: true, // Sortable column
enableHiding: true, // Show/hide toggle
},
]Production tips
Handle empty states gracefully. This free shadcn/ui data table works beautifully with data, but users need to know when there's nothing to show. Add helpful messages like "No users found" or "Try adjusting your filters." Your React component renders the empty state—you provide the context that actually helps users.
Test with realistic data volumes. Those neat demos with 10 rows work great until you have 10,000 customer records. Performance changes dramatically with large datasets. This TypeScript component handles pagination efficiently, but test with production data sizes in your Next.js applications.
Make sorting discoverable. Users expect clickable column headers, but they need visual hints. Add chevron icons or hover states to show what's sortable. This open source shadcn component provides the sorting logic—you provide the visual cues that guide users.
Keep column headers scannable. "Email Address" beats "Email", "Created Date" beats "Date". Users scan headers quickly to understand your data structure. Your JavaScript data table should use descriptive labels that make sense without context.
Consider mobile carefully. Tables get cramped on small screens. Maybe show fewer columns by default, or switch to a card layout below certain breakpoints. This Tailwind CSS component is responsive, but you need to decide what information mobile users actually need.
Integration with other components
Data tables naturally work with Button components for actions like "Add User" or "Export Data" above the table. Use Dialog components for edit forms triggered by row actions.
For filtering interfaces, combine with Input components for search fields and Select components for dropdown filters. This open source pattern keeps filter controls separate from table logic while maintaining clear data flow.
When building admin interfaces, pair data tables with Badge components to show status indicators in cells. Checkbox components handle row selection naturally. Your React application benefits from consistent component patterns across different data views.
For complex data operations, use data tables with Sheet components for detailed row editing or Popover components for quick actions. The table remains the source of truth while related components handle specific interactions.
Questions you might have
Was this page helpful?
Sign in to leave feedback.
Shadcn Context Menu
React context menu component for right-click actions and submenus. Built with TypeScript and Tailwind CSS for Next.js applications using Radix UI primitives.
Shadcn Date Picker
React date picker component with calendar popup and keyboard navigation. Built with TypeScript and Tailwind CSS for Next.js using Popover and Calendar.