Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

export-data

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

export-data - npm Package Compare versions

Comparing version 0.0.3 to 0.1.0

11

lib/cjs/types/components/FileDownloadLink.d.ts
import React from "react";
import { FileType } from "../types";
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 column names of the data. */
columnNames: (string | number)[];
/** The rows of the data. */
rows: (string | number)[][];
/** 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<HTMLAnchorElement>) => void;
/** If the data is set asynchronously in onClick, then this must be set to true. */
setsDataAsyncInOnClick?: boolean;
/** The content for rendering the link. */
children: React.ReactNode;

@@ -12,0 +23,0 @@ };

2

package.json
{
"name": "export-data",
"version": "0.0.3",
"version": "0.1.0",
"description": "Export data in React to CSV and other file formats",

@@ -5,0 +5,0 @@ "types": "./lib/cjs/types/index.d.ts",

# export-data
<span class="badge-npmversion"><a href="https://npmjs.org/package/export-data" title="View this project on NPM"><img src="https://img.shields.io/npm/v/export-data.svg" alt="NPM version" /></a></span>
Export data in React to CSV and other file formats
## Docs
### FileDownloadLink
#### Example
```typescript
<FileDownloadLink
fileType="CSV"
columnNames={["Fruit", "Price"]}
filename="fruits"
rows={[
["Apple", 1],
["Watermelon", 5],
["Durian", 10],
]}
>
Download data
</FileDownloadLink>
```
#### 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 column names of the data. */
columnNames: (string | number)[];
/** The rows of the data. */
rows: (string | number)[][];
/** 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<HTMLAnchorElement>) => void;
/** If the data is set asynchronously in onClick, then this must be set to true. */
setsDataAsyncInOnClick?: boolean;
/** The content for rendering the link. */
children: React.ReactNode;
};
```

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc