npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@uploadcare/react-uploader

v0.3.0

Published

<a href="https://uploadcare.com/?utm_source=github&utm_campaign=uploadcare-js-api-clients"> <img align="right" width="64" height="64" src="https://ucarecdn.com/edfdf045-34c0-4087-bbdd-e3834921f890/userpiccircletransparent.svg" alt=""> </a>

Downloads

272

Readme

Uploadcare React Uploader

Welcome to the Uploadcare React Uploader documentation! This library allows you to seamlessly integrate Uploadcare file uploader into your React applications while adhering to React principles.

Build Status NPM version GitHub release Uploadcare stack on StackShare

Summary about project

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.

Quick Features

  • Seamless integration with React applications
  • Three different upload options: Regular, Inline, and Minimal
  • Customizable styles
  • Access to File Uploader API
  • Comprehensive event handling

Install

npm i @uploadcare/react-uploader

Usage

The Uploadcare React Uploader offers three main components for integration. Each component serves specific use cases and can be easily implemented into your project.

Regular

import {FileUploaderRegular} from "@uploadcare/react-uploader";

<FileUploaderRegular pubkey="YOUR_PUBLIC_KEY"/>;

Inline

import {FileUploaderInline} from "@uploadcare/react-uploader";

<FileUploaderInline pubkey="YOUR_PUBLIC_KEY"/>;

Minimal

import {FileUploaderMinimal} from "@uploadcare/react-uploader";

<FileUploaderMinimal pubkey="YOUR_PUBLIC_KEY"/>;

Props API

An easy way to connect React-Uploader to your project and utilize the available API props. We provide a full set of props that are used in blocks. For review we suggest you to look at the documentation.

Styles

You can customize the appearance of the React uploader using the className prop, which allows you to add custom CSS classes to the uploader FileUploader[Regular | Minimal | Inline] wrapper.

import {FileUploaderRegular} from "@uploadcare/react-uploader";

<FileUploaderRegular className="fileUploaderWrapper" pubkey="YOUR_PUBLIC_KEY"/>;
.fileUploaderWrapper lr-file-uploader-regular {
}

File Uploader API

For convenience, we provide the ability to access the File Uploader API using apiRef. You can see what methods are available in apiRef in the documentation. It is important to note that we now pass all InstanceType from UploadCtxProvider.

import React, {useRef, useEffect} from "react";
import {
    FileUploaderRegular,
    UploadCtxProvider
} from "@uploadcare/react-uploader";

const Example = () => {
    const uploaderRef = useRef < InstanceType < UploadCtxProvider > | null > (null);


    <FileUploaderRegular apiRef={uploaderRef} pubkey="YOUR_PUBLIC_KEY"/>;
}

Events

Events in React Uploader are the same as in blocks, see the documentation. The principle of converting events from blocks to React Uploader:

  1. All events in React Uploader start with on.
  2. All events in React Uploader in camelCase.

Example:

import {FileUploaderRegular} from "@uploadcare/react-uploader";

<FileUploaderRegular
    pubkey="YOUR_PUBLIC_KEY"
    onModalOpen={() => {
        console.log('modal-open')
    }}
/>

Table of events

| Events blocks | Events React Uploader | |------------------------|------------------------| | file-added | onFileAdded | | file-removed | onFileRemoved | | file-upload-start | onFileUploadStart | | file-upload-progress | onFileUploadProgress | | file-upload-success | onFileUploadSuccess | | file-upload-failed | onFileUploadFailed | | file-url-changed | onFileUrlChanged | | modal-open | onModalOpen | | modal-close | onModalClose | | done-click | onDoneClick | | upload-click | onUploadClick | | activity-change | onActivityChange | | common-upload-start | onCommonUploadStart | | common-upload-progress | onCommonUploadProgress | | common-upload-success | onCommonUploadSuccess | | common-upload-failed | onCommonUploadFailed | | change | onChange | | group-created | onGroupCreated |

Security issues

If you think you ran into something in Uploadcare libraries that might have security implications, please hit us up at [email protected] or Hackerone.

We'll contact you personally in a short time to fix an issue through co-op and prior to any public disclosure.

Feedback

Issues and PRs are welcome. You can provide your feedback or drop us a support request at [email protected].