
Security News
Socket Integrates With Bun 1.3’s Security Scanner API
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
@mux/mux-uploader-react
Advanced tools
An uploader element for React that handles Mux Direct Uploads and a visual progress bar for you
<MuxUploader>
is React component for uploading files to Mux.
<MuxUploaderDrop>
is an optional supporting React component for drop-in drag and drop and overlay. You can always configure your own drag and drop with <MuxUploader>
.
If you are looking for a direct upload interface and a progress bar, you're in the right place.
If you're using npm
or yarn
, install that way:
yarn add @mux/mux-uploader-react
or
npm i @mux/mux-uploader-react
Then, import the library into your application with either import
or require
:
import '@mux/mux-uploader-react';
or
require('@mux/mux-uploader-react');
const MuxUploaderWithMuxUploaderDropExample = () => {
return (
<div>
<h1>Simple MuxUploader and Mux Uploader Drop Examples</h1>
{/* Upload button by itself. Displays upload progress in text as percentage. */}
<MuxUploader url="authenticated-url" type="bar" status></MuxUploader>
{/* Upload button by itself. Does not display text percentage. */}
<MuxUploader url="authenticated-url" type="bar"></MuxUploader>
{/* Upload button with access to optional supplentary drag and drop features. */}
<MuxUploaderDrop mux-uploader="uploader">
<MuxUploader url="authenticated-url" id="uploader"></MuxUploader>
</MuxUploaderDrop>
</div>
);
};
<MuxUploader>
Property | Type | Description | Default |
---|---|---|---|
url | string | The authenticated URL that your file will be uploaded to. Check out the direct uploads docs for how to create one. Required. | undefined |
id | string | An ID that allows <MuxUploaderDrop> to locate <MuxUploader> . Required if you use <MuxUploaderDrop> . | N/A |
type | "bar" | Specifies the visual type of progress bar. A radial type is in-progress. | "bar" |
status | boolean | Toggles text status visibility of progress bar. The text that is displayed is a percentage by default. If you prefer just the progress bar with no text upload status, don't include this attribute. | false |
formatProgress | function | A function that accepts numeric percent and is expected to return a string. Allows for customizing how the progress should be rendered. | A function the yields a percent progress string |
<MuxUploaderDrop>
Property | Type | Description | Default |
---|---|---|---|
overlay | boolean | Toggles fullscreen overlay on dragover. | false |
overlayText | boolean | Optional text to display on dragover when overlay is on. | '' |
muxUploader | string | Must match the id on <MuxUploader> . Required. | N/A |
<MuxUploader>
<MuxUploader>
has a handful of events to monitor uploading state.
Prop | Description |
---|---|
onError | Invoked when an error occurs in the chunked upload process. |
onProgress | Invoked whenever a chunk of the file has successfully completed uploading. |
onSuccess | Invoked when the entire file has successfully completed uploading. |
FAQs
An uploader element for React that handles Mux Direct Uploads and a visual progress bar for you
The npm package @mux/mux-uploader-react receives a total of 9,573 weekly downloads. As such, @mux/mux-uploader-react popularity was classified as popular.
We found that @mux/mux-uploader-react demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Research
The Socket Threat Research Team is tracking weekly intrusions into the npm registry that follow a repeatable adversarial playbook used by North Korean state-sponsored actors.
Security News
A data handling bug in OSV.dev caused disputed CVEs to disappear from vulnerability feeds until a recent fix restored over 500 advisories.