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

meta-mosaic

v1.1.0

Published

A simple and responsive React component to create interactive image mosaics with metadata popups, background images, and click-to-enlarge dialogs.

Readme

🧩 MetaMosaic

A simple and responsive React component to create a mosaic grid of images — with background image, custom styles, and click dialog support. ScreenRecording2025-11-29at4 09 29PM-ezgif com-optimize (2)

npm version License Downloads React


🚀 Installation

npm install meta-mosaic
# or
yarn add meta-mosaic

Then import it in your project:

import { MetaMosaic } from "meta-mosaic";
import "meta-mosaic/dist/meta-mosaic.css";

⚡ Quick Example

import React from "react";
import { MetaMosaic } from "meta-mosaic";
import "meta-mosaic/dist/meta-mosaic.css";

const images = Array.from({ length: 400 }, (_, i) => ({
  id: i + 1,
  link: `https://picsum.photos/id/${101 + i}/400/300`,
  title: `Image ${i + 1}`,
}));

const bgImage =
  "https://i.etsystatic.com/32237469/r/il/72bad1/4009560313/il_570xN.4009560313_q4ps.jpg";

function App() {
  return (
    <MetaMosaic
      images={images}
      size={20}
      bgImageUrl={bgImage}
      gridWrapperClassName="custom-mosaic-wrapper"
      gridWrapperStyle={{ boxShadow: "0 0 1em rgba(255,255,255,0.5)" }}
      bgPosition="center 8px"
      width={{ xs: 350, md: 500, lg: 650 }}
      height={{ xs: 350, md: 500, lg: 650 }}
      setDialog={(img) => (
        <div>
          <h2>{img.id}</h2>
          <h6 style={{ color: "red" }}>{img.title}</h6>
          <img src={img.link} alt={img.title} />
        </div>
      )}
    />
  );
}

export default App;

🧩 Props Guide

| Prop | Type | Description | | ------------------------ | ---------- | ---------------------------------------------------------------------------------- | | images | Array | List of images to display in mosaic. Each image should have { id, link, title }. | | size | number | Defines number of rows and columns. Example: size={4} → 4x4 grid. | | bgImageUrl | string | Background image for the mosaic layout. | | gridWrapperClassName | string | Add your custom class to the grid wrapper. | | gridWrapperStyle | object | Inline CSS styles for grid wrapper. | | bgPosition | string | Adjust the background image position (e.g. "center 8px"). | | width | object | Responsive width based on breakpoints: { xs, md, lg }. | | height | object | Responsive height based on breakpoints: { xs, md, lg }. | | setDialog | function | Custom component that opens when clicking a mosaic cell. |


💡 Example: setDialog

setDialog={(img) => (
  <div>
    <h2>{img.id}</h2>
    <h6 style={{ color: 'red' }}>{img.title}</h6>
    <img src={img.link} alt={img.title} />
  </div>
)}

This function runs when a user clicks on a cell. You can render any custom component here.


🪄 Responsive Behavior

You can set different width and height values for small, medium, and large screens:

width={{ xs: 350, md: 500, lg: 650 }}
height={{ xs: 350, md: 500, lg: 650 }}

The component adjusts automatically based on screen size.


📦 Changelog

v1.0.11 — (2025-11-09)

✨ New Features

  • Added all props: images, size, bgImageUrl, gridWrapperClassName, gridWrapperStyle, bgPosition, width, height, and setDialog.
  • Fully responsive and customizable grid.
  • Clickable mosaic cells with custom dialog support.

🧠 Tips

  • Use high-quality images for better visual effect.
  • The bgImageUrl should have similar aspect ratio as your grid.
  • Combine gridWrapperStyle with className for fine-tuned control.

Alternatives & Comparisons

  • react-mosaic-component - More complex, for window management
  • @tilework/mosaic - E-commerce focused
  • react-photo-gallery - Simpler, no dialog support
  • react-grid-gallery - Heavy bundle, more features

meta-mosaic is lightweight and perfect for simple, responsive image grids with metadata.


📜 License

MIT © MetaMosaic