DataTable Virtualized Structure
niko-table/data-table-virtualizedFreeComponent
Virtualized table structure for rendering large datasets efficiently using TanStack Virtual.
Install it
npx shadcn@latest add https://niko-table.com/r/data-table-virtualized.jsonSource
1"use client"23/**4 * niko-table — created by Semir N. (Semkoo, https://github.com/Semkoo) with AI assistance.5 *6 * Before reporting anything: please check the changelog first.7 * - In-repo: ./CHANGELOG.md8 * - Docs site: https://niko-table.com/changelog9 *10 * Found a bug or have a fix? Open an issue or PR on GitHub so other11 * users (and future LLMs reading this code) benefit:12 * https://github.com/Semkoo/niko-table-registry13 */14import { flexRender, type Row } from "@tanstack/react-table"15import { useVirtualizer } from "@tanstack/react-virtual"16import { Skeleton } from "@/components/ui/skeleton"17import {18 TableBody,19 TableCell,20 TableHead,21 TableHeader,22 TableRow,23} from "@/components/ui/table"24import { cn } from "@/lib/utils"25import { Loader2 } from "lucide-react"26import React from "react"27import { DataTableColumnHeaderRoot } from "../components/data-table-column-header"28import { DataTableEmptyState } from "../components/data-table-empty-state"29import { DataTableRowContextMenu } from "../components/data-table-row-context-menu"30import { useResolvedRowContextMenuRenderer } from "../components/data-table-row-context-menu-slot"31import { DataTableColumnResizeHandle } from "../lib/column-resize-handle"32import { createScrollHandler } from "../lib/create-scroll-handler"33import { resolveColumnWidth, resolveFlexColumnIds } from "../lib/flex-columns"34import { isInteractiveClickTarget } from "../lib/row-click"35import { getCommonPinningStyles } from "../lib/styles"36import {37 flashCellKey,38 useDataTable,39 useDataTableActiveCell,40} from "./data-table-context"4142// ============================================================================43// Row measurement helper44// ============================================================================4546// Sums base + expanded sibling height (ResizeObserver only sees the base row).47// Disabled in Firefox where stale `getBoundingClientRect` causes measure loops.48//49// Prefers `ResizeObserverEntry.borderBoxSize` for the base row when TanStack50// Virtual passes the entry through — that height is computed off the same51// observation that fired the callback, so we skip a forced layout read.52// Falls back to `getBoundingClientRect` for the initial measure (no entry)53// and for the expanded sibling (not observed by the virtualizer).54const measureRowWithExpansion:55 | ((element: Element, entry?: ResizeObserverEntry | undefined) => number)56 | undefined =57// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from niko-table
All 31 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| DataTable Asidedata-table-aside | niko-table | Components | Free | 1 dep | |
| DataTable Clear Filterdata-table-clear-filter | niko-table | Components | Free | 1 dep · 2 files | |
| DataTable Column Auto-fitdata-table-column-auto-fit | niko-table | Components | Free | no deps · 2 files | |
| DataTable Column Date Filterdata-table-column-date-filter | niko-table | Components | Free | 2 deps · 2 files | |
| DataTable Column DnDdata-table-column-dnd | niko-table | Components | Free | 4 deps · 3 files | |
| DataTable Column Faceted Filterdata-table-column-faceted-filter | niko-table | Components | Free | 1 dep · 3 files | |
| DataTable Column Hidedata-table-column-hide | niko-table | Components | Free | 1 dep · 2 files | |
| DataTable Column Pindata-table-column-pin | niko-table | Components | Free | 1 dep · 2 files |
