0.1.5 • Published 6 years ago

@bgoodman/simple-file-upload v0.1.5

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

simple-file-upload

A very simple React component implementing the HTML5 File API using a file-type input.

Installation

npm install @bgoodman/simple-file-upload

yarn add @bgoodman/simple-file-upload

Usage

import SimpleFileUpload from "simple-file-upload";
const App: FunctionComponent<{}> = () => {

    const handleChange = (file?:File) => {
        console.log(file);
    }

    return (
        <SimpleFileUpload onChange={handleChange}/>
    )
}

Props

onChange

Callback arg delivers either last committed File by user or undefined otherwise

onChange: (file?: File) => void;

accpet

Provide an array of filetypes or extensions allowed.

accept?: string[];

className

Provide a css class name to override default styles.

className?: string;

Testing

Storybook

Begin preview with

yarn storybook
0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago