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

gridnd

v1.2.0

Published

A drag-and-drop library for customizable grid layouts, supporting hidden cards and dynamic card resizing.

Readme


🚀 Features

  • 📦 Customizable widgets: Create a grid with items of variable sizes (sm, md, lg, xl).
  • ↔️ Drag and drop: Easily reorder cards with drag-and-drop functionality.
  • 👁️ Hide items: Each card can be hidden or resized.

📦 Installation

npm install gridnd
# or
yarn add gridnd

🛠️ Usage

import { Droppable, Draggable, reorderItens } from 'gridnd'
import 'gridnd/style.css'

import { useState } from 'react';
import { Card, cards, CardProps } from '@/components/Card';


export default function Home() {
  const [widgets, setWidgets] = useState<CardProps[]>(cards);

  function handleDropMove(idOrigin: string, idDestiny: string) {
    const indexOrigin = widgets.findIndex(item => item.id.toString() === idOrigin);
    const indexDestiny = widgets.findIndex(item => item.id.toString() === idDestiny);
    
    const result = reorderItens(widgets, indexOrigin, indexDestiny);

    setWidgets(result);
  }

  return (
    <div className="w-screen h-screen bg-slate-900 p-4">
      <Droppable style={{ backgroundColor: '#1e293b' }}>   
        {widgets.map(item =>
          <Draggable
            key={item.id}
            id={item.id.toString()}
            size={item.size}
            onDragMove={handleDropMove}
            isSizingDynamic
            onHidden={() => {}}
          >
            <Card colorStyle={item.colorStyle} title={item.title}/>
          </Draggable>
        )}
      </Droppable>
    </div>
  );
}

📚 Documentation

Props of the component:

This component is the drag area, responsible for organizing the items into a grid.

|Prop | Type | Description| |:-----:|:------------:|:----------| |Children| ReactNode| You need to pass child components inside |

Props of the component:

This component makes the objects draggable.

|Prop| Type| Description| |:-----:|:------------:|:----------| |id | String| ID of the component to be dragged.| |size| 'sm' or 'md' or 'lg' or 'xl'| Size the component will occupy in the grid| |onDragMove | (idOrigin: string, idDestiny: string) => void| Function responsible for managing the drag-and-drop of items| |onHidden (optional) | () => void| Function triggered when hiding cards| |isSizingDynamic (optional) | Boolean| Checks if the card can change its size| |availableSizes (optional) | ('sm' or 'md' or 'lg' or 'xl')[]| Represents the sizes that cards can have| |Children | ReactNode| The component you want to place inside the card must be passed here|

Reorder function:

This function is a standard function for reordering cards.

export function reorderItens<T>(list: T[], indexOrigin: number, indexDestiny:number){
    const result = Array.from(list);
    const [removed] = result.splice(indexOrigin, 1);
    result.splice(indexDestiny, 0, removed);
  
    return result;
  }

🖼️ Demonstration

gridnd

🏗️ Contribution

Contributions are welcome!

📄 License

This project is under the MIT license.