🚀. Socket Launch Week Day 2:Introducing Manifest Alerts.Learn more
Sign In

@howells/stow-react

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@howells/stow-react

React components for Stow file storage

latest
Source
npmnpm
Version
2.4.0
Version published
Maintainers
1
Created
Source

@howells/stow-react

React components for Stow file storage.

Installation

npm install @howells/stow-react
# or
pnpm add @howells/stow-react
# or
yarn add @howells/stow-react

Quick Start

import { UploadDropzone } from "@howells/stow-react";

function MyComponent() {
  return (
    <UploadDropzone
      endpoint="/api/upload"
      onUploadComplete={(files) => {
        console.log("Uploaded:", files);
      }}
      onUploadError={(error) => {
        console.error("Error:", error.message);
      }}
    />
  );
}

Components

<UploadDropzone>

A drag-and-drop file upload zone with built-in progress tracking.

<UploadDropzone
  // Required
  endpoint="/api/upload"
  // Callbacks
  onUploadComplete={(files) => console.log(files)}
  onUploadError={(error) => console.error(error)}
  onUploadProgress={(progress) => console.log(progress.percent)}
  onUploadBegin={(files) => console.log("Starting upload...")}
  // File restrictions
  accept="image/*" // Accepted file types
  maxSize={10 * 1024 * 1024} // Max 10MB
  maxFiles={5} // Max 5 files
  multiple={true} // Allow multiple files
  // Appearance
  className="my-dropzone"
  disabled={false}
  // Optional route for organizing files
  route="avatars"
/>

Props

PropTypeDefaultDescription
endpointstringrequiredYour server upload endpoint
routestring-Optional route for organizing files
onUploadComplete(files: UploadedFile[]) => void-Called when all files uploaded
onUploadError(error: Error) => void-Called on upload error
onUploadProgress(progress: UploadProgress) => void-Called with progress updates
onUploadBegin(files: File[]) => void-Called when upload starts
acceptstring-Accepted file types (e.g., "image/*")
maxSizenumber-Maximum file size in bytes
maxFilesnumber10Maximum number of files
multiplebooleantrueAllow multiple file selection
classNamestring-Custom CSS class
disabledbooleanfalseDisable the dropzone

Types

type UploadedFile = {
  key: string;
  url: string | null;
  name: string;
  size: number;
  type: string;
};

type UploadProgress = {
  file: File;
  loaded: number;
  total: number;
  percent: number;
};

Styling

The component uses inline styles by default. Override with your own CSS:

<UploadDropzone endpoint="/api/upload" className="custom-dropzone" />
.custom-dropzone {
  border: 2px dashed #3b82f6;
  border-radius: 12px;
  padding: 3rem;
  background: #f8fafc;
}

Server Setup

This component requires a server endpoint. Use @howells/stow-next for easy setup:

// app/api/upload/route.ts
import { createUploadHandler } from "@howells/stow-next";
import { StowServer } from "@howells/stow-server";

const stow = new StowServer(process.env.STOW_API_KEY!);

export const POST = createUploadHandler({
  stow,
  maxSize: 10 * 1024 * 1024,
  allowedTypes: ["image/*"],
});

License

MIT

Keywords

components

FAQs

Package last updated on 21 Mar 2026

Did you know?

Socket

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.

Install

Related posts