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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@tigrisdata/react

v1.1.2

Published

React components for Tigris Storage

Readme

@tigrisdata/react

React components for Tigris Storage.

Installation

npm install @tigrisdata/react

Requirements

Usage

Uploader Component

The Uploader component provides a drag-and-drop file upload interface:

import { Uploader } from '@tigrisdata/react';
import '@tigrisdata/react/styles.css'; // Optional: import default styles

function App() {
  return (
    <Uploader
      url="/api/upload"
      multipartThreshold={10 * 1024 * 1024} // Use multipart for files > 10MB
      onUploadComplete={(file, response) => {
        console.log('Uploaded:', response.url);
      }}
      onUploadError={(file, error) => {
        console.error('Failed:', error.message);
      }}
    />
  );
}

Props

| Prop | Type | Default | Description | | -------------------- | ------------------------------------------------ | --------- | ------------------------------------------------------ | | url | string | required | Upload endpoint URL | | multiple | boolean | false | Allow multiple files | | accept | string | - | Accepted file types (e.g., "image/*") | | maxSize | number | - | Maximum file size in bytes | | disabled | boolean | false | Disable the uploader | | multipart | boolean | false | Enable multipart upload for large files | | partSize | number | 5242880 | Part size in bytes for multipart uploads (default 5MB) | | multipartThreshold | number | - | Auto-enable multipart for files larger than this size | | concurrency | number | 4 | Max concurrent uploads (files or multipart parts) | | uploadOptions | UploadOptions | - | Additional storage client options | | onUploadStart | (file: File) => void | - | Called when upload starts | | onUploadProgress | (file: File, progress: UploadProgress) => void | - | Called during upload | | onUploadComplete | (file: File, response: UploadResponse) => void | - | Called on success | | onUploadError | (file: File, error: Error) => void | - | Called on failure | | className | string | - | Custom CSS class | | style | CSSProperties | - | Custom inline styles | | children | ReactNode | - | Custom dropzone content |

useUpload Hook

For custom upload UI, use the useUpload hook:

import { useUpload } from '@tigrisdata/react';

function CustomUploader() {
  const { upload, uploads, isUploading, reset } = useUpload({
    url: '/api/upload',
    multipart: true, // Always use multipart
    partSize: 10 * 1024 * 1024, // 10MB parts
    onUploadComplete: (file, response) => {
      console.log('Done:', response.url);
    },
  });

  const handleFileChange = (e: React.ChangeEvent<HTMLInputElement>) => {
    const file = e.target.files?.[0];
    if (file) {
      upload(file);
    }
  };

  return (
    <div>
      <input type="file" onChange={handleFileChange} disabled={isUploading} />
      {Array.from(uploads.values()).map((state) => (
        <div key={state.file.name}>
          {state.file.name}: {state.progress.percentage}%
        </div>
      ))}
    </div>
  );
}

Return Value

| Property | Type | Description | | ---------------- | ------------------------------------------------------ | --------------------------------- | | upload | (file: File) => Promise<UploadResponse \| undefined> | Upload a single file | | uploadMultiple | (files: File[]) => Promise<...> | Upload multiple files | | uploads | Map<string, FileUploadState> | Current upload states | | isUploading | boolean | Whether any upload is in progress | | reset | () => void | Reset all upload states |

Styling

Default Styles

Import the default stylesheet for a ready-to-use look:

import '@tigrisdata/react/styles.css';

Default styles use CSS @layer tigris, so your custom styles will always take precedence without needing !important.

Custom Styles

The component uses tigris- prefixed class names with state modifiers:

/* Override default styles easily */
.tigris-uploader {
  border-color: purple;
}

CSS Classes

| Class | Description | | ------------------------------------ | -------------------------------------------- | | .tigris-uploader | Container element | | .tigris-uploader.is-dragging | When files are dragged over | | .tigris-uploader.is-uploading | When upload is in progress | | .tigris-uploader.is-disabled | When disabled | | .tigris-uploader-input | Hidden file input | | .tigris-uploader-text | Default text content | | .tigris-uploader-link | "Browse" link text | | .tigris-uploader-filelist | File list container | | .tigris-uploader-file | Individual file item | | .tigris-uploader-file.is-pending | File waiting in queue | | .tigris-uploader-file.is-uploading | File currently uploading | | .tigris-uploader-file.is-success | Upload succeeded | | .tigris-uploader-file.is-error | Upload failed | | .tigris-uploader-filename | File name text | | .tigris-uploader-progress | Progress bar container | | .tigris-uploader-progress-fill | Progress bar fill | | .tigris-uploader-status | Status text (Pending/0-100%/Uploaded/Failed) |

Server Setup

This package works with the @tigrisdata/storage server-side handler:

// app/api/upload/route.ts (Next.js App Router)
import { handleClientUpload } from '@tigrisdata/storage';

export async function POST(request: Request) {
  const body = await request.json();
  const result = await handleClientUpload(body);
  return Response.json(result);
}

License

MIT