Skip to content

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

License

Notifications You must be signed in to change notification settings

rot1024/use-file-input

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

import useFileInput from "use-file-input";

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

About

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages