react-export-csv
v0.0.4
Published
React Export CSV component
Downloads
317
Readme
React Export CSV
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