Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/etr2460/export-data
Export data in React to CSV and other file formats
https://github.com/etr2460/export-data
csv export react typescript
Last synced: about 2 months ago
JSON representation
Export data in React to CSV and other file formats
- Host: GitHub
- URL: https://github.com/etr2460/export-data
- Owner: etr2460
- License: mit
- Created: 2022-12-27T03:06:33.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-12-29T02:21:08.000Z (about 2 years ago)
- Last Synced: 2024-12-13T04:37:22.440Z (about 2 months ago)
- Topics: csv, export, react, typescript
- Language: TypeScript
- Homepage: https://etr2460.github.io/export-data/
- Size: 1.09 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# export-data
Export data in React to CSV and other file formats
## Docs
### FileDownloadLink
#### Example
```typescript
Download data
```
#### Props
```typescript
export type FileDownloadLinkProps = {
/** The type of file to be exported. */
fileType: FileType;
/** The text encoding of the data, utf-8 by default. */
encoding?: string;
/** The data to download. Can be null if the data is set in onClick. */
data: FileDownloadLinkData;
/** The filename for the exported file. */
filename?: string;
/** A function to be called when the link is clicked before the data is downloaded.
* If this function modifies the data to be downloaded, then you must set
* setsDataAsyncInOnClick to true.
*/
onClick?: (e: React.MouseEvent) => void;
/** If the data is set asynchronously in onClick, then this must be set to true.
* Setting this to true will result in an automatic download of data at the next time
* the data changes.
*/
setsDataAsyncInOnClick?: boolean;
/** The content for rendering the link. */
children: React.ReactNode;
};export type FileDownloadLinkData = {
columnNames: (string | number)[];
rows: (string | number)[][];
} | null;
```