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-mosaic-loader

v1.4.0

Published

React image-sampling loader — Mosaic grid of animated dots from image or gradient. Use as loader, placeholder, or visual effect. Supports circle, squircle, diamond, hexagon, and more.

Readme

react-mosaic-loader

npm npm

React image-sampling loader — Renders an image or gradient as a mosaic grid of animated dots by sampling pixel data. Use as a loading spinner, placeholder, or visual effect. Supports multiple shapes (circle, squircle, diamond, hexagon, play icon), custom colors and gradients, size, and quality presets. Degrades to a monochrome grid on load or CORS failure.


Install

npm install react-mosaic-loader

Usage

import { Mosaic } from 'react-mosaic-loader';

<Mosaic
  src="https://example.com/image.jpg"
  size={320}
  gridSize={24}
  shape="circle"
  animationPreset="calm"
  quality="auto"
  renderMode="auto"
  crossOrigin="anonymous"
/>

Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | src | string | null | null | Image URL to sample. Fallback grid if missing or CORS. | | gridSize | number | 16 | Dots per row/column. Ignored if dotCount is set. | | dotCount | number | — | Approximate total dots (grid size = √dotCount per side). | | width | number | 320 | Component width (px). Ignored if size is set. | | height | number | 320 | Component height (px). Ignored if size is set. | | size | number | — | Square size (px). Sets both width and height. | | dotRadius | number | 2.6 | Dot radius (px). | | duration | number | 3400 | Animation cycle (ms). | | speed | number | 1 | Speed multiplier (e.g. 2 = twice as fast). | | minOpacity / maxOpacity | number | preset-based | Opacity range (0–1). | | minScale / maxScale | number | preset-based | Scale range. | | shape | 'square' | 'circle' | 'squircle' | 'play' | 'diamond' | 'hexagon' | 'square' | Dot layout shape. | | color | string | LinearGradient | — | Single color or gradient to override sampled colors. | | easing | string | cubic-bezier(…) | CSS easing. | | renderMode | 'auto' | 'svg' | 'canvas' | 'auto' | Adaptive renderer. Auto uses canvas for larger grids. | | quality | 'auto' | 'high' | 'balanced' | 'low' | 'auto' | Device-aware density/perf profile. | | animationPreset | 'calm' | 'vivid' | 'minimal' | 'calm' | Tuned motion defaults. | | reducedMotion | boolean | system preference | Force reduced-motion behavior. | | crossOrigin | string | 'anonymous' | Image CORS mode. | | className / style | — | — | Container class and inline style. |

Image sampling

  • src — Image URL. If missing, invalid, or CORS-blocked, the component shows a monochrome dot grid.
  • crossOrigin — Use "anonymous" (or "use-credentials") for cross-origin images so the canvas can be read.
  • gap — Optional fixed center-to-center spacing.
  • Sampling results are cached by source and config to avoid repeated pixel reads.

Performance guidance

  • Use quality="auto" for production defaults across mixed devices.
  • Use animationPreset="calm" for premium, low-noise motion.
  • Use size for square loaders (e.g. size={120}) instead of setting width and height separately.
  • Force renderMode="canvas" for very dense grids or full-screen loaders.

Links

License

MIT