drag-and-drop:基于多框架的拖拽排序与列表传输工具库

可轻松为应用添加数据优先的拖拽排序和列表传输功能。该库简单灵活、框架无关,支持React、Vue、Solid及原生JS/TS,具备多拖拽、动画、插入指示、拖放区和列表间传输等特性,仅约4Kb gzipped。【此简介由AI生成】

Branch55Tags63
FilesLast commitLast update
4 months ago
4 months ago
4 months ago
2 years ago
4 months ago
4 months ago
4 months ago
4 months ago
2 years ago
6 months ago
1 year ago
2 years ago
4 months ago
6 months ago
6 months ago
4 months ago
4 months ago
6 months ago
6 months ago
6 months ago
2 years ago

FormKit Drag & Drop — a tiny declarative library for modern apps

Tests npm version gzip size MIT license

Introduction

FormKit's Drag and Drop is a small library for adding data-first drag and drop sorting and transferring of lists to your app. It's simple, flexible, framework agnostic, and clocks in at only ~4Kb gzipped.

Data-first means your array is the source of truth: drag an item and your data reorders with it — no DOM spelunking, no sortable-state to sync. It ships with first-class wrappers for React, Vue, and Solid, works in plain JS/TS, and has built-in support for multi-drag, animations, insert indicators, drop zones, drag handles, and list-to-list transfers.

Quick start

npm install @formkit/drag-and-drop
import { useDragAndDrop } from "@formkit/drag-and-drop/react";

export function Tapes() {
  const [ref, tapes] = useDragAndDrop([
    "Depeche Mode",
    "Duran Duran",
    "Pet Shop Boys",
    "Kraftwerk",
  ]);

  return (
    <ul ref={ref}>
      {tapes.map((tape) => (
        <li key={tape}>{tape}</li>
      ))}
    </ul>
  );
}

That's a fully sortable list — drag the items and tapes stays in order. The same API is available for Vue, Solid, and vanilla JS/TS.

Read the docs


Created by the FormKit team · MIT License

Introduction

可轻松为应用添加数据优先的拖拽排序和列表传输功能。该库简单灵活、框架无关,支持React、Vue、Solid及原生JS/TS,具备多拖拽、动画、插入指示、拖放区和列表间传输等特性,仅约4Kb gzipped。【此简介由AI生成】

Customize your domain
121.95 K53Visit GitHub