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-vanish-box

v0.1.1

Published

A React/Next.js component that dissolves any element (a box, card, or your own custom design) into animated particles — with left-to-right sweep or all-at-once modes and adjustable speed.

Readme

react-vanish-box

A React / Next.js component that dissolves any element — a box, a card, your own custom design — into animated particles, "Thanos snap" style.

  • Works with any JSX children (not just a fixed box). Whatever you render inside <VanishBox> is what vanishes — text, images, icons, buttons, all of it.
  • Two vanish modes: sweep (left → right wipe) or instant (the whole element fragments and fades all at once).
  • Adjustable speed.
  • Ships as a functional component with hooks — no classes, fully typed (TypeScript .d.ts included).
  • Zero runtime dependencies (only react / react-dom as peer deps).
  • Next.js App Router ready ("use client" is baked into the build).

Install

npm install react-vanish-box
# or
yarn add react-vanish-box
# or
pnpm add react-vanish-box

Basic usage

Plain children — click anywhere on the box to vanish it:

import { VanishBox } from "react-vanish-box";

export default function Example() {
  return (
    <VanishBox onDeleted={() => console.log("gone!")}>
      <div style={{ padding: 24, background: "#1e293b", color: "#fff", borderRadius: 12 }}>
        Click to vanish
      </div>
    </VanishBox>
  );
}

Using your own design + your own delete button

Use the render-prop form so a button inside your own markup becomes the trigger, and you get live status to update its label:

import { VanishBox } from "react-vanish-box";

export default function Card({ onRemove }: { onRemove: () => void }) {
  return (
    <VanishBox onDeleted={onRemove}>
      {(vanish, status) => (
        <div className="card">
          <h3>Noteworthy technology acquisitions</h3>
          <p>Here are the biggest acquisitions of 2025 so far.</p>
          <button onClick={vanish} disabled={status !== "idle"}>
            {status === "idle" && "Delete"}
            {status === "deleting" && "Deleting..."}
            {status === "deleted" && "Deleted"}
          </button>
        </div>
      )}
    </VanishBox>
  );
}

Triggering it from outside (imperative ref)

import { useRef } from "react";
import { VanishBox, type VanishBoxHandle } from "react-vanish-box";

export default function Example() {
  const ref = useRef<VanishBoxHandle>(null);

  return (
    <>
      <VanishBox ref={ref}>
        <div className="card">Some content</div>
      </VanishBox>
      <button onClick={() => ref.current?.vanish()}>Delete from outside</button>
      <button onClick={() => ref.current?.reset()}>Bring it back</button>
    </>
  );
}

Vanish modes & speed

// Left-to-right wipe (default)
<VanishBox mode="sweep" speed={1}>...</VanishBox>

// Whole element fragments and fades all at once
<VanishBox mode="instant" speed={1}>...</VanishBox>

// Faster / slower
<VanishBox mode="sweep" speed={2}>...</VanishBox>   {/* 2x speed */}
<VanishBox mode="sweep" speed={0.5}>...</VanishBox> {/* half speed */}

Props

| Prop | Type | Default | Description | |-------------------|--------------------------------------------------------------------|------------|-------------------------------------------------------------------------------| | children | ReactNode \| ((vanish, status) => ReactNode) | — | Content to render and vanish. Function form gives you a vanish() trigger. | | mode | "sweep" \| "instant" | "sweep" | "sweep" dissolves left→right. "instant" fragments the whole thing at once. | | speed | number | 1 | Speed multiplier. 2 = twice as fast, 0.5 = half speed. | | onDeleteStart | () => void | — | Called the instant the vanish starts. |

| className | string | — | Applied to the outer wrapper. | | style | React.CSSProperties | — | Applied to the outer wrapper. |

Imperative handle (via ref)

| Method | Description | |-------------|-----------------------------------------------| | vanish() | Trigger the vanish animation. | | reset() | Restore the content back to idle state. This is not applicable for real database . |

How it works

VanishBox renders your children in a normal (visible, interactive) DOM node. When triggered, it rasterizes that live node — including all nested styles and children — onto a <canvas>, reads the pixel data, converts non-transparent pixels into particles, then animates those particles (jittering, shrinking, and either sweeping across or fading out together) until nothing is left.

License

MIT