Debian Codegraph @

node/@patternfly/react-core/src/deprecated/components/DragDrop/examples/DragDrop.md

raw
1 ---
2 id: Drag and drop
3 section: components
4 propComponents: [DragDrop, Draggable, Droppable, DraggableItemPosition]
5 title: Drag and drop
6 deprecated: true
7 ---
8 import { useState } from 'react';
9
10 You can use the `<DragDrop>` component to move items in or between lists. The `<DragDrop>` component should contain `<Droppable>` components which contain `<Draggable>` components.
11
12 ```ts noLive
13 import { DragDrop, Draggable, Droppable } from '@patternfly/react-core/deprecated';
14
15 const DragDropCodeSample: React.FunctionComponent = () => (
16 <DragDrop>
17 {' '}
18 {/* DragDrop houses the context for dragging and dropping */}
19 <Droppable>
20 <Draggable>You can put anything here! It will be wrapped in a styled div.</Draggable>
21 <Draggable>You can have as many Draggables as you like.</Draggable>
22 </Droppable>
23 <Droppable>
24 {' '}
25 {/* You can also have many droppables! */}
26 <Draggable />
27 </Droppable>
28 </DragDrop>
29 );
30 ```
31
32 Note: Keyboard accessibility and screen reader accessibility are still in development.
33
34 ## Examples
35
36 ### Basic
37
38 ```ts file="./DragDropBasic.tsx"
39
40 ```
41
42 ### Multiple lists
43
44 ```ts file="./DragDropMultipleLists.tsx"
45
46 ```