Build a data table, use tanstack tables and for ui use shadcn tokens.
Add 500 fake records in the table.
implement the following features from tanstack library
I'll create a comprehensive data table implementation using TanStack Table with shadcn UI components, similar to the one in your image but with all the requested features. Let's build this step by step.
This implementation includes all the features you requested:
Additional Features:
The implementation generates 500 fake payment records using Faker.js with realistic data including IDs, amounts, statuses, emails, and dates.
To use this in your project, you'll need to install the following dependencies:
npm install @tanstack/react-table @tanstack/react-virtual @tanstack/match-sorter-utils @faker-js/fakerThe data table follows the shadcn UI design system and uses their components for a consistent look and feel 12. The implementation is based on the shadcn data table pattern but enhanced with the virtualization and infinite scrolling features you requested.
Let's fix the error in the data-table-view-options.tsx file. The issue is that we're importing DropdownMenuTrigger directly from Radix UI instead of from our shadcn components.
The error occurred because we were importing DropdownMenuTrigger directly from @radix-ui/react-dropdown-menu while importing the other dropdown menu components from our shadcn UI components. This inconsistency breaks the context relationship between the dropdown menu components.
In Radix UI (which shadcn/ui is built on), components like DropdownMenuTrigger must be used within the context provided by their parent component (DropdownMenu). When you import some components from the shadcn wrapper and others directly from Radix, they don't share the same context.
The fix ensures all dropdown menu components are imported from the same place - our shadcn UI components at @/components/ui/dropdown-menu. This maintains the proper component hierarchy and context relationship.
Now the data table should work correctly without the context error. All the features you requested (virtualized infinite scrolling, row selection, sorting, column ordering, and fuzzy search) should function as expected.