React component for file uploads using Uploadcare
npm install @uploadcare/react-uploader
Website •
Docs •
Blog •
Discord •
Twitter
[![NPM version][npm-img]][npm-url]
[![Build Status][badge-build]][build-url]
[![GitHub release][badge-release-img]][badge-release-url]
[![Uploadcare stack on StackShare][badge-stack-img]][badge-stack-url]
Welcome to the Uploadcare React Uploader documentation!
This documentation provides guidance on how to use the Uploadcare React Uploader in your projects, along with details
about its features, installation process, usage examples, customization options, event handling, and security
considerations.
``bash`
npm install @uploadcare/react-uploader
2. Connect React Uploader from your script file:
`jsx
import { FileUploaderRegular } from "@uploadcare/react-uploader";
import "@uploadcare/react-uploader/core.css";
`
For convenience, we provide the ability to access the File Uploader API using apiRef.apiRef
You can see what methods are available in in the [documentation][uc-docs-file-uploader-api].
`jsx
import React, {useRef, useEffect} from "react";
import {
FileUploaderRegular,
UploadCtxProvider
} from "@uploadcare/react-uploader";
import "@uploadcare/react-uploader/core.css";
const Example = () => {
const uploaderRef = useRef
}
`
1. All events in React Uploader start with on.camelCase
2. All events in React Uploader in .
`jsx
import { FileUploaderRegular } from "@uploadcare/react-uploader";
import "@uploadcare/react-uploader/core.css";
onModalOpen={() => {
console.log('modal-open')
}}
/>
`
prop, which lets you apply custom CSS classes to the FileUploader wrapper, including the Regular, Minimal, and Inline variations.However, if you need to assign a class specifically to the uploader file. Use the
classNameUploader prop.`jsx
import { FileUploaderRegular } from "@uploadcare/react-uploader";
import "@uploadcare/react-uploader/core.css"; classNameUploader="uc-dark"
className="fileUploaderWrapper"
pubkey="YOUR_PUBLIC_KEY"
/>;
``css
.fileUploaderWrapper uc-file-uploader-regular {
}
`Next.js
File Uploader does not support Server-side Rendering (SSR), we have a special import for nextjs that already has SSR disabled.
You will need to import with import @uploadcare/react-uploader/next`jsx
'use client'
import { FileUploaderRegular } from "@uploadcare/react-uploader/next";
import "@uploadcare/react-uploader/core.css";function App() {
return
};
``If you think you ran into something in Uploadcare libraries that might have
security implications, please hit us up at
[bugbounty@uploadcare.com][uc-email-bounty] or Hackerone.
We'll contact you personally in a short time to fix an issue through co-op and
prior to any public disclosure.
Issues and PRs are welcome. You can provide your feedback or drop us a support
request at [hello@uploadcare.com][uc-email-hello].
[uc-email-bounty]: mailto:bugbounty@uploadcare.com
[uc-email-hello]: mailto:hello@uploadcare.com
[github-releases]: https://github.com/uploadcare/react-uploader/releases
[github-branch-release]: https://github.com/uploadcare/react-uploader/tree/release
[github-contributors]: https://github.com/uploadcare/react-uploader/graphs/contributors
[badge-stack-img]: https://img.shields.io/badge/tech-stack-0690fa.svg?style=flat
[badge-stack-url]: https://stackshare.io/uploadcare/stacks/
[badge-release-img]: https://img.shields.io/github/release/uploadcare/react-components.svg
[badge-release-url]: https://github.com/uploadcare/react-uploader/releases
[npm-img]: http://img.shields.io/npm/v/@uploadcare/react-uploader.svg
[npm-url]: https://www.npmjs.com/package/@uploadcare/react-uploader
[badge-build]: https://github.com/uploadcare/react-uploader/actions/workflows/checks.yml/badge.svg
[build-url]: https://github.com/uploadcare/react-uploader/actions/workflows/checks.yml
[uc-docs-events]: https://uploadcare.com/docs/file-uploader/events/
[uc-docs-file-uploader-api]: https://uploadcare.com/docs/file-uploader/api
[uc-docs-file-uploader-options]: https://uploadcare.com/docs/file-uploader/options/