1.2.0 • Published 1 year ago

react-json-to-csv v1.2.0

Weekly downloads
2,104
License
MIT
Repository
github
Last release
1 year ago

⌗ react-json-to-csv

A react button component to easily generate csv downloads of your json data. ✨

npm package version  npm downloads  code style: prettier

Live Demo

https://react-json-to-csv.coston.io

Features

  • Create a csv download from json data
  • Lightweight
  • Easy to use
  • optional filename

Install

Install with npm:

npm i react-json-to-csv

Or load from a CDN:

<script src="https://cdn.jsdelivr.net/npm/react-json-to-csv" />

Example Usage

import CsvDownloadButton from 'react-json-to-csv'
...

<CsvDownloadButton data={mockData} />

Props

#PropertyTypeRequirementDefaultDescription
1data[]requiredarray of objects
2filenamestringoptional"export.csv"The filename. The .csv extention will be edded if not included in file name
3delimiterstringoptional";"fields separator
4headersstring[]optionalprovided data object keysList of columns that will be used in the final CSV file.

Typescript Support

Install types with npm

npm i --save-dev @types/react-json-to-csv

Contributing

Please help provide good data faster! Submit any issues and/or make a pull request!