Sha256: 604163632aeed54c4b940cc7f9e526cd954069c39aa3c774df286e32272e30fe
Contents?: true
Size: 1.08 KB
Versions: 7
Compression:
Stored size: 1.08 KB
Contents
import React, { useState } from "react"; import { SelectableList, Draggable, DraggableProvider } from "../../"; // Initial items to be dragged const data = [ { id: "1", text: "Task 1", }, { id: "2", text: "Task 2", }, { id: "3", text: "Task 3", }, { id: "4", text: "Task 4", }, ]; const DraggableDefault = (props) => { const [initialState, setInitialState] = useState(data); return ( <> <DraggableProvider initialItems={data} onReorder={(items) => setInitialState(items)} > <Draggable.Container {...props}> <SelectableList variant="checkbox"> {initialState.map(({ id, text }) => ( <Draggable.Item id={id} key={id} > <SelectableList.Item label={text} name={id} value={id} /> </Draggable.Item> ))} </SelectableList> </Draggable.Container> </DraggableProvider> </> ); }; export default DraggableDefault;
Version data entries
7 entries across 7 versions & 2 rubygems