diff --git a/packages/components/table/src/virtualized-table.tsx b/packages/components/table/src/virtualized-table.tsx
index f5e3d00c36..60f548086c 100644
--- a/packages/components/table/src/virtualized-table.tsx
+++ b/packages/components/table/src/virtualized-table.tsx
@@ -44,9 +44,18 @@ const VirtualizedTable = forwardRef<"table", TableProps>((props, ref) => {
return children;
}
- return {children};
+ return (
+
+ {children}
+
+ );
},
- [removeWrapper, getWrapperProps],
+ [removeWrapper, getWrapperProps, maxTableHeight],
);
const items = [...collection.body.childNodes];
@@ -75,73 +84,68 @@ const VirtualizedTable = forwardRef<"table", TableProps>((props, ref) => {
return (
{/* We need to add p-1 to make the shadow-sm visible */}
-
- {topContentPlacement === "outside" && topContent}
-
- <>
- {topContentPlacement === "inside" && topContent}
-
-
- {collection.headerRows.map((headerRow) => (
-
- {[...headerRow.childNodes].map((column) =>
- column?.props?.isSelectionCell ? (
-
- ) : (
-
- ),
- )}
-
- ))}
-
-
-
-
- {bottomContentPlacement === "inside" && bottomContent}
- >
-
- {bottomContentPlacement === "outside" && bottomContent}
-
+
+ <>
+ {topContentPlacement === "outside" && topContent}
+
+ <>
+ {topContentPlacement === "inside" && topContent}
+
+
+ {collection.headerRows.map((headerRow) => (
+
+ {[...headerRow.childNodes].map((column) =>
+ column?.props?.isSelectionCell ? (
+
+ ) : (
+
+ ),
+ )}
+
+ ))}
+
+
+
+
+ {bottomContentPlacement === "inside" && bottomContent}
+ >
+
+ {bottomContentPlacement === "outside" && bottomContent}
+ >
+
);
});
diff --git a/packages/components/table/stories/table.stories.tsx b/packages/components/table/stories/table.stories.tsx
index dd9991e24f..96fa4f5b46 100644
--- a/packages/components/table/stories/table.stories.tsx
+++ b/packages/components/table/stories/table.stories.tsx
@@ -1155,3 +1155,40 @@ export const Virtualized = {
className: "max-w-3xl",
},
};
+
+export const TenThousandRows = {
+ render: (args: TableProps) => {
+ const rows = generateRows(10000);
+ const columns = [
+ {key: "name", label: "Name"},
+ {key: "value", label: "Value"},
+ ];
+
+ return (
+
+
+
+ {(column) => {column.label}}
+
+
+ {(item) => (
+
+ {(columnKey) => {item[columnKey]}}
+
+ )}
+
+
+
+ );
+ },
+ args: {
+ ...defaultProps,
+ className: "max-w-3xl",
+ },
+};