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

Export data in React to CSV and other file formats

  • 0.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

export-data

NPM version

Export data in React to CSV and other file formats

Docs

Example
<FileDownloadLink
  fileType="CSV"
  filename="fruits"
  data={{
    columnNames: ["Fruit", "Price"],
    rows: [
      ["Apple", 1],
      ["Watermelon", 5],
      ["Durian", 10],
    ],
  }}
>
  Download data
</FileDownloadLink>
Props
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<HTMLAnchorElement>) => 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;

Keywords

FAQs

Package last updated on 29 Dec 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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