1.2.2 • Published 5 months ago

react-fzk-drag-and-drop v1.2.2

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

React Drag and Drop Component

A simple and reusable drag and drop component for React applications.

Installation

npm install react-fzk-drag-and-drop
yarn add react-fzk-drag-and-drop

Usage

import { DragAndDrop } from 'react-fzk-drag-and-drop';
import {DragItem} from 'react-fzk-drag-and-drop'

function App() {
  const [items, setItems] = useState<DragItem[]>([
    { id: 1, title: "First Item" },
    { id: 2, title: "Second Item" },
    { id: 3, title: "Third Item" },
  ]);

  return (
    <DragAndDrop
      items={items}
      displayKey="title"
      onItemsChange={setItems}
    />
  );
}

Props

PropTypeDescription
itemsDragItem[]Array of items to be displayed and reordered
displayKeykeyof DragItemKey to be used for displaying item content
onItemsChange(items: DragItem[]) => voidCallback function called when items are reordered

License

MIT

1.2.2

5 months ago

1.2.1

5 months ago

1.2.0

5 months ago

1.1.1

5 months ago

1.1.0

5 months ago

1.0.0

5 months ago