# react-json-to-csv

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

Latest version **1.2.0** (published 2022-11-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-json-to-csv
pnpm add react-json-to-csv
yarn add react-json-to-csv
bun add react-json-to-csv
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2022-11-11 |
| First published | 2019-02-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/react-json-to-csv) |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 7.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 55 |
| Author | Coston Perkins |
| Maintainers | coston |
| Keywords | react, react-component, json, csv, button, download |

## Links

- npm: https://www.npmjs.com/package/react-json-to-csv
- Repository: https://github.com/coston/react-json-to-csv
- Issues: https://github.com/coston/react-json-to-csv/issues
- npm.io page: https://npm.io/package/react-json-to-csv

## Dependencies (1)

- [json-to-csv-export](https://npm.io/package/json-to-csv-export.md) 2.1.0

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.2.0 (latest) — 2022-11-11
- 1.1.0 — 2022-10-30
- 1.0.4 — 2019-02-21
- 1.0.3 — 2019-02-21
- 1.0.2 — 2019-02-21
- 1.0.1 — 2019-02-21
- 1.0.0 — 2019-02-21

## README

# ⌗ react-json-to-csv

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

[![npm package version](https://badge.fury.io/js/react-json-to-csv.svg)](https://www.npmjs.com/package/react-json-to-csv)&nbsp;
[![npm downloads](https://img.shields.io/npm/dm/react-json-to-csv.svg)](https://www.npmjs.com/package/react-json-to-csv)&nbsp;
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://prettier.io)

## Live Demo

[https://react-json-to-csv.coston.io](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:

```sh
npm i react-json-to-csv
```

Or load from a CDN:

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

## Example Usage

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

<CsvDownloadButton data={mockData} />
```

## Props

| #   | Property  | Type       | Requirement | Default                   | Description                                                                   |
| --- | --------- | ---------- | ----------- | ------------------------- | ----------------------------------------------------------------------------- |
| 1   | data      | `[]`       | `required`  |                           | array of objects                                                              |
| 2   | filename  | `string`   | `optional`  | "export.csv"              | The filename. The `.csv` extention will be edded if not included in file name |
| 3   | delimiter | `string`   | `optional`  | ";"                       | fields separator                                                              |
| 4   | headers   | `string[]` | `optional`  | provided data object keys | List of columns that will be used in the final CSV file.                      |

## Typescript Support

Install types with npm

```sh
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!

---
_Source: https://npm.io/package/react-json-to-csv · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
