Nonchalantly Performs Magic
Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

react-file-picker

0.0.6 • Public • Published

react-file-picker

Build Status Coverage Status npm

Sensible file input wrappers. Demo included.

npm i react-file-picker

Examples

import { FilePicker } from 'react-file-picker'
 
const MyComponent = () => (
  <FilePicker
    extensions={['md']}
    onChange={FileObject => (/* do something with File object */)}
    onError={errMsg => (/* do something with err msg string */)
  >
    <button>
      Click to upload markdown
    </button>
  </FilePicker>
)
import { ImagePicker } from 'react-file-picker'
 
const MyComponent = () => (
  <ImagePicker
    extensions={['jpg', 'jpeg', 'png']}
    dims={{minWidth: 100, maxWidth: 500, minHeight: 100, maxHeight: 500}}
    onChange={base64 => (/* do something with base64 encoded string */)
    onError={errMsg => (/* do something with err msg string */)
  >
    <button>
      Click to upload image
    </button>
  </ImagePicker>
)

Demo

npm run demo

Install

npm i react-file-picker

DownloadsWeekly Downloads

2,849

Version

0.0.6

License

MIT

Unpacked Size

20.4 kB

Total Files

4

Last publish

Collaborators

  • avatar