TypeScript
---
title: React CSV Viewer
description: A React CSV viewer component for spreadsheet-like previews of CSV and TSV files with upload, parsing, zoom, and large-table virtualization.
component: true
---
The React CSV Viewer covers exports, imports, tabular logs, and datasets that need fast CSV or TSV previews without full spreadsheet rendering.
<CsvViewerDemo />
## Installation
Glide Data Grid renders overlay editors into a root portal. Add this element as
the last child of your app's `<body>` before using the component:
```tsx
<div id="portal" className="fixed top-0 left-0 z-40" />
```
<Callout variant="info" title="Next.js SSR">
Glide Data Grid uses browser-only APIs. If you see SSR errors, render the CSV
Viewer through `next/dynamic` with `ssr: false`.
<DocsMdxCodeBlock
language="tsx"
code={`"use client"
import dynamic from "next/dynamic"
const CsvViewer = dynamic(
() => import("@/components/extend/csv-viewer").then((mod) => mod.CsvViewer),
{ ssr: false }
)`}
/>
</Callout>
<CodeTabs>
<TabsList>
<TabsTrigger value="cli">Command</TabsTrigger>
<TabsTrigger value="manual">Manual</TabsTrigger>
</TabsList>
<TabsContent value="cli">
```bash
npx shadcn@latest add @extend/csv-viewer
```
</TabsContent>
<TabsContent value="manual">
<Steps className="mb-0 pt-2">
<Step>Install the following dependencies:</Step>
```bash
npm install @glideapps/[email protected] papaparse@^5.5.3
```
<Step>Install the icon library configured in your `components.json`:</Step>
The component source references icons through the shadcn CLI's
`IconPlaceholder`, which supports every `iconLibrary` the CLI does: `lucide`,
`tabler`, `hugeicons`, `phosphor`, and `remixicon`. Installing with the CLI
replaces each placeholder with the matching icon from your configured library,
so make sure that library's package is installed. When copying the source
manually, replace each `IconPlaceholder` element with the icon named by the
prop for your library.
<Step>Copy and paste the following code into your project.</Step>
<CsvViewerSource />
<Step>Update the import paths to match your project setup.</Step>
</Steps>
</TabsContent>
</CodeTabs>
## Useful behaviors
- PapaParse-backed CSV and TSV parsing with empty-row handling.
- Virtualized rows and columns through Glide Data Grid.
- Optional toolbar search via the `search` prop. When enabled, results update as you type with debounced matching, result navigation, cell selection, and scroll-into-view.
- Header controls for upload, row and column counts, and zoom.
- Grid zoom that scales row height, header height, column width, and cell text.
## API Reference
### CsvViewer
The CsvViewer component renders its built-in CSV/TSV upload flow, parser state, zoom controls, and virtualized grid.
| Prop | Type | Default | Required |
| ----------- | --------- | ------- | -------- |
| `className` | `string` | `-` | No |
| `data` | `string` | `-` | No |
| `search` | `boolean` | `false` | No |