@bgoodman/simple-file-upload
v0.1.5
Published
A very simple React component implementing the HTML5 File API using a file-type input.
Downloads
3
Readme
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