Sha256: 868abdfa21079e81221389b49f0c8ba6efa45364901c6b74af6007c41b45a054
Contents?: true
Size: 1.07 KB
Versions: 62
Compression:
Stored size: 1.07 KB
Contents
import React, { useState } from "react"; import { SelectableList, DraggableProvider } from "../../"; // Initial items to be dragged const data = [ { id: "41", text: "Task 1", }, { id: "42", text: "Task 2", }, { id: "43", text: "Task 3", }, { id: "44", text: "Task 4", }, ]; const DraggableWithSelectableList = (props) => { const [initialState, setInitialState] = useState(data); return ( <> <DraggableProvider initialItems={data} onReorder={(items) => setInitialState(items)} > <SelectableList enableDrag variant="radio" {...props} > {initialState.map(({ id, text }) => ( <SelectableList.Item dragId={id} key={id} label={text} name="radio-test" value={id} {...props} /> ))} </SelectableList> </DraggableProvider> </> ); }; export default DraggableWithSelectableList
Version data entries
62 entries across 62 versions & 2 rubygems