dditems
v1.0.7
Published
A simple and customizable React component for creating draggable lists.
Downloads
21
Readme
React Reorderable List by Drag and drop.
A simple and customizable React component for creating draggable lists.
Demo: View Demo
Installation
You can install the packagedditems
via npm or yarn:
npm install dditems
Code Snipits
import React, { useState } from 'react';
import { DragAndDropList } from 'dditems';
const MyComponent = () => {
const [items, setItems] = useState([
{ id: '1', content: 'Item 1' },
{ id: '2', content: 'Item 2' },
{ id: '3', content: 'Item 3' }
]);
const handleReorder = (updatedItems) => {
setItems(updatedItems);
};
return (
<div>
<h2>My Drag and Drop List</h2>
<DragAndDropList
items={items}
onReorder={handleReorder}
/>
</div>
);
};
export default MyComponent;