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

@mshafiqyajid/react-sortable

v0.1.0

Published

Drag-and-drop sortable list with keyboard reordering and spring animations.

Readme

@mshafiqyajid/react-sortable

Drag-and-drop sortable list with keyboard reordering and spring animations. Zero runtime dependencies — built on native pointer events.

Full docs →

Install

npm install @mshafiqyajid/react-sortable

Quick start — styled component

import { useState } from "react";
import { SortableStyled } from "@mshafiqyajid/react-sortable/styled";
import "@mshafiqyajid/react-sortable/styles.css";

interface Task {
  id: string;
  title: string;
  done: boolean;
}

function App() {
  const [items, setItems] = useState<Task[]>([
    { id: "1", title: "Design tokens", done: false },
    { id: "2", title: "Write tests",   done: true  },
    { id: "3", title: "Ship it",       done: false },
  ]);

  return (
    <SortableStyled
      items={items}
      onReorder={setItems}
      renderItem={(item, { isDragging }) => (
        <span style={{ opacity: isDragging ? 0.5 : 1 }}>
          {item.title}
        </span>
      )}
    />
  );
}

Headless hook

import { useSortable } from "@mshafiqyajid/react-sortable";

const { containerProps, getItemProps, getItemState, activeId } = useSortable({
  items,
  onReorder: setItems,
});

const { ref, ...restContainerProps } = containerProps;

return (
  <ul ref={ref} {...restContainerProps}>
    {items.map((item) => (
      <li key={item.id} {...getItemProps(item)}>
        {item.label}
      </li>
    ))}
  </ul>
);

Props — SortableStyled

| Prop | Type | Default | Description | |---|---|---|---| | items | SortableItem[] | — | Array of items with a required id field | | onReorder | (items: SortableItem[]) => void | — | Called when order changes | | renderItem | (item, state) => ReactNode | — | Render each item; receives isDragging, isOver, handleProps | | orientation | "vertical" \| "horizontal" | "vertical" | List direction | | handle | boolean | true | Show drag handle grip icon | | disabled | boolean | false | Disable all drag and keyboard interaction | | animationDuration | number | 200 | Transition duration in milliseconds | | className | string | — | Additional class name on the container | | style | React.CSSProperties | — | Inline styles on the container |

SortableItem type

interface SortableItem {
  id: string | number;
  [key: string]: unknown;
}

Keyboard controls

| Key | Action | |---|---| | Space | Pick up / drop item | | Enter | Drop item at current position | | ArrowUp / ArrowDown | Move item (vertical list) | | ArrowLeft / ArrowRight | Move item (horizontal list) | | Escape | Cancel — restore original order |

A live region announces position changes to screen readers during keyboard reordering.

CSS variables

--rsort-bg               /* container background */
--rsort-item-bg          /* item background */
--rsort-item-fg          /* item text color */
--rsort-item-border      /* item border color */
--rsort-item-radius      /* item border radius */
--rsort-item-shadow      /* item box shadow */
--rsort-item-padding     /* item padding */
--rsort-handle-color     /* grip icon color */
--rsort-gap              /* gap between items */
--rsort-font-size        /* item font size */
--rsort-over-bg          /* drop target background */
--rsort-over-border      /* drop target border color */
--rsort-active-opacity   /* opacity of the picked-up ghost */
--rsort-duration         /* transition duration (ms) */
--rsort-focus-ring       /* keyboard focus ring */

ARIA

  • Container: role="listbox", aria-orientation
  • Items: role="option", aria-roledescription="sortable item", aria-grabbed
  • Live region: role="status", aria-live="assertive" — announces position changes during keyboard reorder

License

MIT