use-file-input
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

use-file-input

React Hooks for selecting files with hidden <input type="file" />

npm install --save use-file-input
# or 
yarn add use-file-input

Usage

const Component = () => {
  const handleFileSelect = useFileInput(
    (files) => {
      // files is FileList
      // do something with selected files
    },
    { accept: "image/*", multiple: true }
  );
 
  return (
    <button onClick={handleFileSelect}>
      Select files
    </button>
  );
};

License

MIT License

Readme

Keywords

none

Package Sidebar

Install

npm i use-file-input

Weekly Downloads

41

Version

1.0.0

License

MIT

Unpacked Size

38 kB

Total Files

7

Last publish

Collaborators

  • rot1024