Quick Examples
Column Virtualization Example
An example of a Shadcn Table with column virtualization enabled to achieve higher performance when rendering large data sets
Shadcn Table has a built-in column virtualization feature (via @tanstack/react-virtual) that allows you to render a large number of columns without major performance issues that you would normally see with a large number of DOM elements.
Try out the performance of the table below with 500 columns! Filtering, Search, and Sorting also maintain usable performance.
Be sure to also check out the full virtualization feature guide docs to learn about both Row and Column Virtualization.
NOTE: You should only enable row virtualization if you have a large number of rows or columns. Depending on the size of the table, if you are rendering fewer than a couple dozen rows at a time, you will actually just be adding extra overhead to the table renders. Virtualization only becomes necessary when you have over 50 rows or so at the same time with no pagination or dozens of columns.
View Extra Storybook Examples
Row Virtualization Example
An example of a Shadcn Table with row virtualization enabled to achieve higher performance when rendering large data sets
Infinite Scrolling Example
An example of Shadcn Table which shows how to implement an infinite scrolling table that fetches data from a remote server as the user scrolls down the table with the useInfiniteQuery hook from react-query