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

@lp-labs/react-sortable

v0.1.0

Published

Dependency-free React sortable lists with pointer and keyboard handles.

Readme

@lp-labs/react-sortable

Pointer/touch and keyboard sortable lists. React 18+ peer only; no runtime drag-and-drop framework, CSS import or icon dependency. TypeScript, ESM, CommonJS and browser entries included.

Installation

npm install @lp-labs/react-sortable

Requires React 18 or later in the host application. Pointer dragging requires a browser with Pointer Events; keyboard sorting is also supported. Server-side rendering is supported. Node.js consumers require Node.js 18 or later.

Quick Start

import { useState } from 'react';
import Sortable from '@lp-labs/react-sortable';

export default function Example() {
  const [items, setItems] = useState([
    { id: 'first', name: 'First task' },
    { id: 'second', name: 'Second task' },
    { id: 'third', name: 'Third task' },
  ]);

  return (
    <Sortable items={items} onChange={setItems}>
      {({ item, handleProps }) => (
        <>
          <button {...handleProps} title={`Move ${item.name}`}>Move</button>
          <span>{item.name}</span>
        </>
      )}
    </Sortable>
  );
}

Items And Renderers

Use controlled items/onChange or defaultItems. getId(item) defaults to item.id or the primitive item; IDs must be unique nonempty strings or finite numbers. Custom renderers receive {item,index,dragging,handleProps}; spread all handle props, including its ref and touch-action style, onto a button. getLabel supplies accessible labels. Without a renderer, each item is its own labeled button.

Sortable API

| Prop | Default | Description | | --- | --- | --- | | items / defaultItems | [] | Controlled or initial item order | | getId(item) | item.id or primitive item | Stable unique item identifier | | getLabel(item) | label, name, or ID | Accessible item label | | onChange(items, { id, from, to }) | none | Committed reorder; indices are zero-based | | direction | 'vertical' | 'vertical' or 'horizontal' | | disabled | false | Disable all sorting | | disabledIds | [] | Items that cannot be grabbed or targeted | | onDragStart(id) | none | Pickup notification | | onDragEnd({ id, from, to }) | none | Completed drop, even if the order is unchanged | | onDragCancel(id) | none | Canceled interaction | | label | 'Sortable list' | Accessible list label |

className, style, and itemStyle customize the wrapper and rows. Only onChange commits a changed order; preview reorders remain local while dragging. Apply onChange when supplying controlled items. Escape, pointer cancellation, window blur, changed item arrays or disabling the list cancels the draft. defaultItems initializes internal state only.

Keyboard And Pointer Controls

Space/Enter picks up and drops an item; arrows move it along the list's axis; Home/End jump; Escape cancels. Position changes are announced through a live region. Disabled IDs cannot be grabbed or targeted, although their positions can shift when other items move past them. Pointer targets use the nearest row center. Keep IDs and controlled arrays stable during a drag.

Helpers And Limits

arrayMove(items, from, to) returns a reordered array without mutating the input. Indices must refer to existing items; an unchanged move returns the original array.

This is an in-place list sorter, not a general drag-and-drop engine. No cross-list drops, virtualization, drag ghost/portal, automatic edge scrolling, nested-grid collision engine, RTL keyboard inversion or animation is provided. Touch scrolling is suppressed on the handle only. Keep the handle separate from other interactive content.

Support

Support maintenance with a PayPal donation.

Author

Created by Libin Prasanth.