@bgoodman/simple-file-upload
TypeScript icon, indicating that this package has built-in type declarations

0.1.5 • Public • Published

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

Dependencies (0)

    Dev Dependencies (38)

    Package Sidebar

    Install

    npm i @bgoodman/simple-file-upload

    Weekly Downloads

    2

    Version

    0.1.5

    License

    MIT

    Unpacked Size

    30.7 kB

    Total Files

    7

    Last publish

    Collaborators

    • bgoodman