@dnd-kit/react 0.3.0-beta-20260214232423 → 0.3.0-beta-20260214235656
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -6
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -2,16 +2,49 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://npm.im/@dnd-kit/react)
|
|
4
4
|
|
|
5
|
-
The React
|
|
5
|
+
The React adapter for **@dnd-kit** — a lightweight, performant, and extensible drag and drop toolkit. Built on top of `@dnd-kit/dom`.
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
```
|
|
9
|
+
```bash
|
|
12
10
|
npm install @dnd-kit/react
|
|
13
11
|
```
|
|
14
12
|
|
|
15
|
-
##
|
|
13
|
+
## Quick start
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import {DragDropProvider, useDraggable, useDroppable} from '@dnd-kit/react';
|
|
17
|
+
|
|
18
|
+
function App() {
|
|
19
|
+
const [parent, setParent] = useState(null);
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<DragDropProvider
|
|
23
|
+
onDragEnd={(event) => {
|
|
24
|
+
if (event.canceled) return;
|
|
25
|
+
setParent(event.operation.target?.id ?? null);
|
|
26
|
+
}}
|
|
27
|
+
>
|
|
28
|
+
{parent == null ? <Draggable /> : null}
|
|
29
|
+
<Droppable>{parent ? <Draggable /> : 'Drop here'}</Droppable>
|
|
30
|
+
</DragDropProvider>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Hooks
|
|
36
|
+
|
|
37
|
+
| Hook | Import | Description |
|
|
38
|
+
|---|---|---|
|
|
39
|
+
| `useDraggable` | `@dnd-kit/react` | Make an element draggable |
|
|
40
|
+
| `useDroppable` | `@dnd-kit/react` | Create a drop target |
|
|
41
|
+
| `useSortable` | `@dnd-kit/react/sortable` | Combine drag and drop with sorting |
|
|
42
|
+
|
|
43
|
+
## Components
|
|
44
|
+
|
|
45
|
+
- **`<DragDropProvider>`** — Wraps your drag and drop interface, manages sensors, plugins, and events.
|
|
46
|
+
- **`<DragOverlay>`** — Renders a custom overlay element during drag operations.
|
|
47
|
+
|
|
48
|
+
## Documentation
|
|
16
49
|
|
|
17
|
-
Visit [
|
|
50
|
+
Visit [next.dndkit.com](https://next.dndkit.com/react) for full documentation, guides, and interactive examples.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dnd-kit/react",
|
|
3
|
-
"version": "0.3.0-beta-
|
|
3
|
+
"version": "0.3.0-beta-20260214235656",
|
|
4
4
|
"main": "./index.cjs",
|
|
5
5
|
"module": "./index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -56,9 +56,9 @@
|
|
|
56
56
|
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@dnd-kit/abstract": "0.3.0-beta-
|
|
60
|
-
"@dnd-kit/dom": "0.3.0-beta-
|
|
61
|
-
"@dnd-kit/state": "0.3.0-beta-
|
|
59
|
+
"@dnd-kit/abstract": "0.3.0-beta-20260214235656",
|
|
60
|
+
"@dnd-kit/dom": "0.3.0-beta-20260214235656",
|
|
61
|
+
"@dnd-kit/state": "0.3.0-beta-20260214235656",
|
|
62
62
|
"tslib": "^2.6.2"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|