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

react-pixcraft

v1.0.8

Published

Lightweight React image editor with crop, rotate, flip, and scale. Uses only React + native Canvas API.

Downloads

682

Readme

Under maintenance – We're fixing known issues. Use with caution. Updates will be published when ready.

react-pixcraft

A lightweight React image editor with crop, rotate, flip, and scale. Uses only React and the native HTML5 Canvas API. Use it as a full editor or as edit-before-upload middleware in your upload flow.

Features

  • Crop – Free-form or fixed aspect ratio (e.g. 16:9, 1:1)
  • Rotate – 90° left, 90° right, 180°
  • Flip – Horizontal and vertical
  • Scale – Resize by width/height with aspect ratio lock
  • Undo / Redo
  • Export – Get edited image as Blob

Installation

npm install react-pixcraft

Peer Dependencies

  • react >= 17.0.0
  • react-dom >= 17.0.0

Two ways to use

1. Component-first (edit inside the editor)

User opens the editor, uploads or picks an image inside it, edits, then saves. You get the result in onExport.

import { ImageEditor } from "react-pixcraft";

function App() {
  const [showEditor, setShowEditor] = useState(false);

  const handleExport = (blob, meta) => {
    // Upload blob to your server, or trigger download, etc.
    uploadToServer(blob);
    setShowEditor(false);
  };

  return (
    <>
      <button onClick={() => setShowEditor(true)}>Edit profile picture</button>
      {showEditor && (
        <ImageEditor
          src={null}
          onExport={handleExport}
          onClose={() => setShowEditor(false)}
          maxViewport={{ width: 1920, height: 1080 }}
          mime="image/png"
        />
      )}
    </>
  );
}

2. Edit-before-upload (middleware)

User selects a file in your UI → editor opens with that file → user edits → on Save you get a Blob and upload it. Pass the File via the file prop; the component creates and revokes the object URL for you.

import { ImageEditor } from "react-pixcraft";

function App() {
  const [selectedFile, setSelectedFile] = useState(null);

  const handleExport = (blob, meta) => {
    uploadToServer(blob);  // Upload the edited image, not the original file
    setSelectedFile(null);
  };

  return (
    <>
      <input
        type="file"
        accept="image/*"
        onChange={(e) => setSelectedFile(e.target.files?.[0] ?? null)}
      />
      {selectedFile && (
        <ImageEditor
          file={selectedFile}
          onExport={handleExport}
          onClose={() => setSelectedFile(null)}
          mime="image/jpeg"
        />
      )}
    </>
  );
}

Props

| Prop | Type | Default | Description | |-----------------------|------------|----------------------|----------------------------------------------------------------| | src | string | null | Initial image URL (or null to upload first). Ignored if file is set. | | file | File | — | File to edit (e.g. from an input). Use for edit-before-upload; object URL is managed internally. | | onExport | function | — | (blob, { width, height, mime }) => void | | onClose | function | — | Called when the editor is closed (e.g. modal close) | | maxViewport | object | { width: 1920, height: 1080 } | Max display size | | mime | string | "image/png" | Output MIME type (e.g. "image/jpeg") | | className | string | — | Optional CSS class for the editor root | | modal | boolean | true | Render as a modal overlay; false for inline | | theme | "light" \| "dark" \| "auto" | "light" | Visual theme; "auto" uses prefers-color-scheme | | labels | object | — | Override button/label text (i18n). See types for keys. | | classNameToolbar | string | — | Optional class for the toolbar container | | classNameCanvasWrapper | string | — | Optional class for the canvas wrapper | | classNameModal | string | — | Optional class for the modal box | | classNameOverlay | string | — | Optional class for the modal overlay | | styles | object | — | Override styles: root, card, toolbar, canvasWrapper, overlay, modal |

Theming with CSS variables

The editor root uses the class react-pixcraft-editor and sets these CSS variables so you can override them to match your site:

  • --rp-bg, --rp-surface, --rp-border, --rp-text, --rp-text-muted
  • --rp-primary, --rp-primary-hover, --rp-input-bg
  • --rp-overlay, --rp-shadow, --rp-checker

Example: dark theme override

.react-pixcraft-editor[data-theme="dark"] {
  --rp-bg: #0d1117;
  --rp-primary: #58a6ff;
  /* ... */
}

License

MIT