1.0.2 • Published 9 months ago
@ihatecode/react-file-picker v1.0.2
@ihatecode/react-file-picker
Englist | 中文
Introduction
A file picker component written in React.
Install
# npm
npm install @ihatecode/react-file-picker
# yarn
yarn add @ihatecode/react-file-picker
# pnpm
pnpm add @ihatecode/react-file-pickerUsage
import React from 'react';
import FilePicker from '@ihatecode/react-file-picker';
import '@ihatecode/react-file-picker/lib/style.css';
const App: React.FC = () => {
return (
<FilePicker
multiple
accept="image/*"
onChange={(files) => console.log(files)}
>
<span>Select files</span>
</FilePicker>
);
};
export default App;Demo
Online demo: https://pjzpz7.csb.app/
Props
| Property | Type | Optional |
|---|---|---|
| className | string | Y |
| style | object | Y |
| accept | string | Y |
| multiple | boolean | Y |
| directory | boolean | Y |
| draggable | boolean | Y |
| children | any | Y |
| onChange | (files: FileList) => void | Y |
License
MIT