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

perdana-draggable-list

v1.0.6

Published

React drag-and-drop list with a grab handle and automatic sizing for variable-height cards.

Readme

Perdana Draggable List

React drag-and-drop list with a grab handle and automatic sizing for variable-height cards.

Demo

Perdana Draggable List demo

Features

  • Drag to reorder by clicking a handle (no full-card drag conflicts with inputs).
  • Cards resize to their content; drop targets respect real heights.
  • Minimal API with render callbacks for full custom layouts.
  • Lightweight: a single component and a small CSS footprint.

Installation

npm install perdana-draggable-list

Requires React 18+ (tested with React 18/19). Ensure your bundler supports CSS imports from JS.

Quick start

import React, { useState } from "react";
import PerdanaDraggableList from "perdana-draggable-list";

const initial = [
  { id: "item-1", title: "First", description: "A short note" },
  { id: "item-2", title: "Second", description: "A longer note\nwith multiple lines" },
];

export default function Example() {
  const [items, setItems] = useState(initial);

  return (
    <PerdanaDraggableList
      data={items}
      gap={12}
      onDragEnd={(_, __, next) => setItems(next)}
      renderItem={(index, item) => (
        <div style={{ display: "flex", flexDirection: "column", gap: 6 }}>
          <strong>{item.title}</strong>
          <textarea
            value={item.description}
            onChange={(e) => {
              const next = [...items];
              next[index].description = e.target.value;
              setItems(next);
            }}
          />
        </div>
      )}
    />
  );
}

Props

| Prop | Type | Default | Description | | --- | --- | --- | --- | | data | Array<{ id: string, ... }> | required | Items to render; each item needs a unique id. | | gap | number | 12 | Vertical gap between cards (px). | | onDragStart | (startIndex: number) => void | — | Called when a drag begins. | | onDragEnd | (start: number, end: number, nextData: Array) => void | — | Called when a drag ends; nextData is the reordered list. | | renderItem | (index: number, item: any) => ReactNode | default renderer | Custom card content. Receives the item and its current index. | | renderHandleIcon | () => ReactElement | burger icon | Custom grab handle icon element. | | containerClassName | string | "" | Extra class for the container. | | cardItemClassName | string | "" | Extra class for each card. |

Styling hooks

  • Root: .pg-board-container
  • Card: .pg-card (active state: .pg-card.pg-card-active)
  • Grab handle: .pg-grab-btn (active state: .pg-grab-btn.pg-grab-btn-active)
  • Default content styles: .pg-card-title, .pg-card-wrapper

Override these in your own CSS or pass containerClassName / cardItemClassName to attach your classes. The component imports its base CSS; include it (or copy the rules) in your app’s bundle.

Notes

  • The component measures card heights after render, so dynamic content (inputs, text areas) will still drop correctly.
  • Dragging is handle-only to avoid fighting with form controls inside cards. Use renderHandleIcon to swap the icon if needed.