Gathering detailed insights and metrics for @byu-law/react-csv-reader
Gathering detailed insights and metrics for @byu-law/react-csv-reader
Gathering detailed insights and metrics for @byu-law/react-csv-reader
Gathering detailed insights and metrics for @byu-law/react-csv-reader
React component that handles csv file input and its parsing
npm install @byu-law/react-csv-reader
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
57 Commits
1 Branches
Updated on Mar 02, 2020
Latest Version
2.0.2
Package Id
@byu-law/react-csv-reader@2.0.2
Unpacked Size
81.71 kB
Size
28.07 kB
File Count
10
NPM Version
6.14.1
Node Version
13.9.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
3
React component that handles csv file input.
It handles file input and returns its content as a matrix.
You can try it out in a demo on Codesandbox.
Install the package with either yarn or npm.
With yarn:
1yarn add react-csv-reader
With npm:
1npm install --save react-csv-reader
Basic usage:
1import React, { Component } from 'react' 2import ReactDOM from 'react-dom' 3import CSVReader from 'react-csv-reader' 4 5class App extends Component { 6 ... 7 8 render() { 9 return ( 10 <CSVReader onFileLoaded={(data, fileName) => console.log(data, fileName)} /> 11 ) 12 } 13} 14 15ReactDOM.render(<App />, document.getElementById('root'))
More complex example:
1import React, { Component } from 'react' 2import ReactDOM from 'react-dom' 3import CSVReader from 'react-csv-reader' 4 5class App extends Component { 6 ... 7 8 const papaparseOptions = { 9 header: true, 10 dynamicTyping: true, 11 skipEmptyLines: true, 12 transformHeader: header => 13 header 14 .toLowerCase() 15 .replace(/\W/g, '_') 16 } 17 18 render() { 19 return ( 20 <CSVReader 21 cssClass="csv-reader-input" 22 label="Select CSV with secret Death Star statistics" 23 onFileLoaded={this.handleForce} 24 onError={this.handleDarkSideForce} 25 parserOptions={papaparseOptions} 26 inputId="ObiWan" 27 inputStyle={{color: 'red'}} 28 /> 29 ) 30 } 31} 32 33ReactDOM.render(<App />, document.getElementById('root'))
Name | Type | Default | Description |
---|---|---|---|
cssClass | string | csv-reader-input | A CSS class to be applied to the wrapper element. |
cssInputClass | string | csv-input | A CSS class to be applied to the <input> element. |
label | string, element | If present, it will be rendered in a <label> to describe input aim. | |
onFileLoaded | function | (required) The function to be called passing loaded results. | |
onError | function | Error handling function. | |
parserOptions | object | {} | PapaParse configuration object override |
inputId | string | An id to be applied to the <input> element. | |
inputStyle | object | {} | Some style to be applied to the <input> element. |
fileEncoding | string | UTF-8 | Encoding type of the input file |
When the file has been loaded, it will be parsed with PapaParse from a CSV formatted text to a matrix of strings or a list of objects (using header
option).
That matrix is returned to the parent component with onFileLoaded
function (it will be passed as an argument).
The second argument to onFileLoaded
will be the filename provided
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
no SAST tool detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
55 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-14
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More