react-uploader
Advanced tools
Comparing version 2.3.3 to 2.3.4
{ | ||
"name": "react-uploader", | ||
"version": "2.3.3", | ||
"version": "2.3.4", | ||
"author": "Upload <hello@upload.io> (https://upload.io)", | ||
@@ -5,0 +5,0 @@ "description": "React File Upload UI Widget — Lightweight & supports: drag and drop, multiple uploads, image cropping, customization & more 🚀 Comes with Cloud Storage 🌐", |
@@ -46,3 +46,3 @@ <h1 align="center"> | ||
Quick Start — | ||
<a href="https://codepen.io/upload-js/pen/popWJpX?editors=1010"> | ||
<a href="https://codepen.io/upload-js/pen/popWJpX?editors=0010"> | ||
Try on CodePen | ||
@@ -100,35 +100,31 @@ </a> | ||
# Usage | ||
## UploadButton — [Try on CodePen](https://codepen.io/upload-js/pen/popWJpX?editors=0010) | ||
Initialize once at the start of your application: | ||
The `UploadButton` component uses a [render prop](https://reactjs.org/docs/render-props.html) to provide an `onClick` callback to your button element. | ||
When clicked, a file upload modal will appear: | ||
```javascript | ||
import { Uploader } from "uploader"; | ||
import { Uploader } from "uploader"; // Installed by "react-uploader". | ||
import { UploadButton } from "react-uploader"; | ||
// Get production API keys from Upload.io | ||
// Initialize once (at the start of your app). | ||
const uploader = Uploader({ | ||
apiKey: "free" | ||
apiKey: "free" // Get production API keys from Upload.io | ||
}); | ||
``` | ||
Then choose a UI component: | ||
// Configuration options: https://upload.io/uploader#customize | ||
const options = { multi: true }; | ||
## `UploadButton` | ||
The `UploadButton` component uses a [render prop](https://reactjs.org/docs/render-props.html) to provide an `onClick` callback to your button element. | ||
When clicked, a file upload modal will appear: | ||
```javascript | ||
import { UploadButton } from "react-uploader"; | ||
<UploadButton uploader={uploader} | ||
options={{multi: true}} | ||
onComplete={files => console.log(files)}> | ||
{({onClick}) => | ||
<button onClick={onClick}> | ||
Upload a file... | ||
</button> | ||
} | ||
</UploadButton> | ||
const MyApp = () => ( | ||
<UploadButton uploader={uploader} | ||
options={options} | ||
onComplete={files => alert(files.map(x => x.fileUrl).join("\n"))}> | ||
{({onClick}) => | ||
<button onClick={onClick}> | ||
Upload a file... | ||
</button> | ||
} | ||
</UploadButton> | ||
); | ||
``` | ||
@@ -144,3 +140,3 @@ | ||
## `UploadDropzone` | ||
## UploadDropzone — [Try on CodePen](https://codepen.io/upload-js/pen/LYrMzaB?editors=0010) | ||
@@ -150,12 +146,22 @@ The `UploadDropzone` component renders an inline drag-and-drop file upload dropzone: | ||
```javascript | ||
import { UploadDropzone } from "react-uploader"; | ||
import { Uploader } from "uploader"; // Installed by "react-uploader". | ||
import { UploadButton } from "react-uploader"; | ||
<UploadDropzone uploader={uploader} | ||
options={{multi: true}} | ||
onUpdate={files => console.log(files)} | ||
width="600px" | ||
height="375px" /> | ||
// Initialize once (at the start of your app). | ||
const uploader = Uploader({ | ||
apiKey: "free" // Get production API keys from Upload.io | ||
}); | ||
// Configuration options: https://upload.io/uploader#customize | ||
const options = { multi: true }; | ||
const MyApp = () => ( | ||
<UploadDropzone uploader={uploader} | ||
options={options} | ||
onUpdate={files => alert(files.map(x => x.fileUrl).join("\n"))} | ||
width="600px" | ||
height="375px" /> | ||
); | ||
``` | ||
Required props: | ||
@@ -221,3 +227,3 @@ - `uploader` | ||
Uploader's USP is to provide the fastest way to integrate end-to-end file uploads into a web app, while remaining customizable. As such, Uploader will always be closely integrated with the Upload.io platform, and there are currently no plans to support custom backends. You may, however, sync files from your Upload.io account to a custom storage target. | ||
**Yes!** [Upload.io](https://upload.io) supports custom S3 buckets. You are still required to create an account. | ||
@@ -224,0 +230,0 @@ ## Contribute |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
114816
236