npm.io
0.0.4 • Published 4 years ago

react-export-csv

Licence
MIT
Version
0.0.4
Deps
0
Size
13 kB
Vulns
0
Weekly
0

React Export CSV

NPM JavaScript Style Guide

React Export CSV component for React.

Installation

npm install --save react-export-csv

Documentation

Props Type Default Details
header array null header for CSV file
data array null data row for CSV file
separator string ; CSV separator (";" / "," / ...)
callback function null callback data
isDownload boolean false if auto download file
filename string "no_name.csv" file name downloaded file

Getting started

Import Component and style
import { ExportCSV } from 'react-export-csv'
Render Component
<ExportCSV
  header={[
    {
      name: "Col 1",
      key: "col_1"
    },
    {
      name: "Col 2",
      key: "col_2"
    }
  ]}
  data={[
    {
      col_1: "Data 1 col 1",
      col_2: "Data 1 col 2"
    },
    {
      col_1: "Data 2 col 1",
      col_2: "Data 2 col 2"
    }
  ]}
  separator={';'}
  callback={(res) => console.log(res)}
  isDownload={true}
  filename={"test.csv"}
/>

License

MIT noah-lnt