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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@uploadbox/ui

v0.11.0

Published

Ready-made video components for Uploadbox: a full player, video cards, animated previews and a thumbnail strip.

Readme

@uploadbox/ui

Ready-made video components for React: a full player, a vertical feed, video cards with hover previews, a section editor, a thumbnail strip and a drag-and-drop dropzone.

They work in any React app. They need no Tailwind and no router.

Install

npm install @uploadbox/ui hls.js
import "@uploadbox/ui/styles.css";

VideoPlayer

import { VideoPlayer, cloudflareThumbnailTemplate } from "@uploadbox/ui";

<VideoPlayer
  src={hlsUrl}
  poster={thumbnailUrl}
  thumbnailTemplate={cloudflareThumbnailTemplate(hlsUrl)}
  downloadUrl={mp4Url}
  resumeKey={video.id}
/>

The player has quality, speed, subtitles and audio track menus, picture in picture, fullscreen, a frame preview on the seek bar and keyboard shortcuts. Set downloadUrl to show a download button. Set resumeKey to continue from the last position on this device. Set keyboardShortcuts={false} when a page has several players.

| Key | Action | | --- | --- | | Space, k | Play or pause | | Left, Right | Back or forward 5 seconds | | j, l | Back or forward 10 seconds | | Up, Down | Volume | | m | Mute | | c | Subtitles | | f | Fullscreen | | i | Picture in picture | | <, > | Speed | | 0 to 9 | Jump to a position |

Loop mode

mode="loop" turns the player into something like a GIF: muted, without controls, and playing only while on screen. People who ask for reduced motion see the poster.

<VideoPlayer src="/demo.mp4" poster="/demo.jpg" mode="loop" />

VideoGrid and VideoCard

import Link from "next/link";
import { VideoGrid } from "@uploadbox/ui";

<VideoGrid videos={videos} linkComponent={Link} />

Give a video a previewSrc, an HLS manifest or a video file, and hovering plays short sections from across it. Nothing loads until the pointer stays on the card, and touch screens keep the still. Links are plain anchors unless you pass linkComponent.

VideoPreview is the frame on its own, for layouts of your own.

VideoFeed

A vertical feed: one video at a time, snapping into place and playing on its own. It keeps the previous video and the next preload videos loaded, so scrolling is instant, and leaves the rest as posters so a long feed stays light.

<VideoFeed
  videos={videos} // { id, src, poster }
  preload={2}
  renderOverlay={(video) => <Caption video={video} />}
  onEndReached={loadMore}
  onDoubleTap={like}
/>

Give it a parent with a height. It starts muted, because browsers block sound until someone interacts. Tap to pause, double tap to call onDoubleTap. Up, Down, j and k change video, m toggles the sound and Space pauses. Links and buttons in the overlay stay clickable, and taps anywhere else reach the video.

VideoSectionEditor

A timeline for choosing which sections a hover preview plays. Click to add a section, drag to move it, and drag its edges to resize it. With value={null} it shows the defaults, and they stay the defaults until someone changes one.

const [sections, setSections] = useState<PreviewSection[] | null>(null);

<VideoSectionEditor src={url} value={sections} onChange={setSections} />

src can be the blob URL of a file that has not been uploaded yet, or a path on your own site, and the timeline captures its frames from the file. For a stream, pass thumbnailTemplate. Save the result and pass it to a card as sections. Sections last 0.5 to 6 seconds, up to 8 per video, as set in SECTION_LIMITS.

CoverPicker

Takes a custom cover by drop or click, and shows the current one with a remove button. It hands you the file, so it works with any upload path.

<CoverPicker value={coverUrl} onFile={save} onRemove={remove} />

TransferTray

One panel for the uploads and downloads in a tab. Mount it once in a layout, so a transfer carries on while people move between pages.

// In your root layout
<TransferTray />

Long uploads should not die when someone changes page. Start them with startVideoUpload from @uploadbox/video/react, which keeps them outside React. The tray follows each video through uploading, saving and processing, and the browser asks before the tab closes while bytes are moving.

import { startVideoUpload } from "@uploadbox/video/react";

startVideoUpload({
  endpoint: "/api/create-upload",
  file,
  save: async (videoId) => {
    const { id } = await saveVideo(videoId);
    return { href: `/watch/${id}`, statusUrl: `/api/videos/${id}/status` };
  },
});

statusUrl answers { state, progress }, with state as processing, ready or failed. On Cloudflare Stream, progress is the video's status.pctComplete.

DownloadLink downloads a file in four parallel Range requests and shows the progress in the tray. href can be your route that checks the viewer and redirects to a signed URL: only the first request goes through it, and the other parts reuse the signed URL. The bucket must answer cross-origin Range requests, as the hosted one does. Call startDownload with the same options to start one from code.

<DownloadLink href={`/api/files/${id}?download`} size={file.size} name={file.name}>
  Download
</DownloadLink>

startDownload joins the parts in memory, so files over 512 MB go to the browser's own download, without the tray. A file whose parts fail goes there too, so href must send it as an attachment. The tray's text is English; pass content to translate it. content holds functions, so in Next.js render the tray from a client component.

VideoUploadTray is the old name of TransferTray.

VideoProcessingBar

Shows the same progress on a page opened later, from the same statusUrl.

<VideoProcessingBar statusUrl={`/api/videos/${id}/status`} onDone={refresh} />

ThumbnailStrip

A scrollable row of frames, for choosing a thumbnail or a moment:

<ThumbnailStrip
  thumbnailTemplate={template}
  duration={video.duration}
  value={seconds}
  onSelect={setSeconds}
/>

VideoDropzone

Drag a video in, or click to browse. It hands you the file, so it works with any upload path:

<VideoDropzone
  onFile={(file) => upload(file)}
  onReject={() => toast.error("Choose a video file")}
  hint="MP4 or MOV, up to 4 GB"
/>

Thumbnail templates

A template is a URL with a {time} placeholder for whole seconds, so these components work with any video host:

"https://cdn.example.com/video-1/frame.jpg?at={time}"

cloudflareThumbnailTemplate(hlsUrl) builds one for Cloudflare Stream.

Theming

Set these variables on a component, a parent or :root. They are the same names as the @uploadbox/react widgets.

| Variable | Used for | | --- | --- | | --ubx-accent | Seek bar, selection, drag highlight | | --ubx-text | Titles | | --ubx-muted | Secondary text and icons | | --ubx-surface | Empty frames and avatars | | --ubx-radius | Corners | | --ubx-preview-ratio | Shape of a preview frame, such as 9 / 16 for tall tiles |

Without them, the components use dark colors inside an element with the dark class or data-theme="dark".