CSV Viewer
retab-ui/csv-viewerFreeComponent
A fixed-window virtualized CSV/TSV table: sortable columns, sticky header, row numbers, horizontal scroll. Renders straight from raw rows (no table row model) so it stays flat in memory on huge files.
Install it
npx shadcn@latest add https://ui.retab.com/r/csv-viewer.jsonSource
1"use client";23import * as React from "react";45import { useKeyedMountEffect } from "@/hooks/use-keyed-mount-effect";6import type { CsvDialect, CsvTable } from "@/lib/csv";7import {8 createViewerResource,9 type ViewerResource,10} from "@/lib/viewer-resource";1112import {13 CsvViewerFrame,14 CsvViewerHeader,15 csvViewerStatusNode,16} from "./csv-viewer-chrome";17import {18 csvViewerDownloadActions,19 defaultCsvDownloadName,20} from "./csv-viewer-download";21import { CsvGrid, type CsvGridHandle } from "./csv-viewer-grid";22import {23 csvViewerExportFileName,24 csvViewerSortResetKey,25 isCsvDocumentSource,26 resolveCsvViewerDialect,27 type CsvDocumentSource,28 type CsvTableSource,29 type CsvViewerSource,30} from "./csv-viewer-resource";31import { useCsvResourceState, type CsvCellAddress } from "./csv-viewer-state";32import type { CsvViewerHandle, CsvViewerProps } from "./csv-viewer-types";33import {34 useViewerControlsRegistration,35 type ViewerControlsState,36} from "./viewer-controls";37import { joinEffectKey } from "@/lib/effect-key";3839export type {40 CsvScrollOptions,41 CsvViewerHandle,42 CsvViewerProps,43} from "./csv-viewer-types";4445export type CsvResourceContentProps = Omit<CsvViewerProps, "source"> & {46 resource?: ViewerResource | null;47 source?: CsvViewerSource;48};49type CsvResourceContentInternalProps = CsvResourceContentProps & {50 frame?: boolean;51};5253export type CsvViewerProviderProps = {54 children: React.ReactNode;55 resource: ViewerResource;56};5758export type CsvViewerGridProps = Omit<CsvResourceContentProps, "resource">;5960export const CsvViewer = React.forwardRef<CsvViewerHandle, CsvViewerProps>(61 function CsvViewer({ source, ...props }, ref) {62 const resource = React.useMemo<ViewerResource | null>(63 () =>64 source && isCsvDocumentSource(source)65 ? createViewerResource(source)66 : null,67 [source],68 );69 return (70 <CsvResourceContent71 {...props}72 frame73 ref={ref}74 resource={resource}75 source={source}76 />77 );78 },79);8081const CsvViewerResourceContext = React.createContext<ViewerResource | null>(82 null,83);8485export function CsvViewerProvider({86 children,87 resource,88}: CsvViewerProviderProps) {89 return (90 <CsvViewerResourceContext.Provider value={resource}>91 {children}92 </CsvViewerResourceContext.Provider>93 );94}9596function useCsvViewerResource(): ViewerResource {97 const resource = React.useContext(CsvViewerResourceContext);98 if (!resource) {99// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from retab-ui
All 130 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Alertalert | retab-ui | Components | Free | 1 dep | |
| Alert Dialogalert-dialog | retab-ui | Components | Free | 1 dep | |
| Aspect Ratioaspect-ratio | retab-ui | Components | Free | no deps | |
| Attachment Sidebarattachment-sidebar | retab-ui | Components | Free | 1 dep | |
| Autocompleteautocomplete | retab-ui | Components | Free | 2 deps | |
| Calendarcalendar | retab-ui | Components | Free | 2 deps | |
| Code Viewercode-viewer | retab-ui | Components | Free | 2 deps · 32 files | |
| Commandcommand | retab-ui | Components | Free | 2 deps |
