Draggable - @dnd-kit – Documentation
Home Examples Github Search ⌘ K Overview INTRODUCTION Installation Quick start API DOCUMENTATION DndContext Droppable Draggable useDraggable Drag Overlay Sensors Modifiers PRESETS Sortable GUIDES Accessibility Powered By GitBook Draggable Use the useDraggable hook turn DOM nodes into draggable sources that can be picked up, moved and dropped over droppable containers. Usage The useDraggable hook isn't particularly opinionated about how your app should be structured. Node ref At minimum though, you need to pass the setNodeRef function that is returned by the useDraggable hook to a DOM element so that it can access the underlying DOM node and keep track of it to detect collisions and intersections with other droppable elements. import {useDraggable} from '@dnd-kit/core'; import {CSS} from '@dnd-kit/utilities'; function Draggable() { const {attributes, listeners, setNodeRef, transform} = useDraggable({ id: 'unique-id', }); const style = { transform: CSS.Translate.toStr
Usage The useDraggable hook isn’t particularly opinionated about how your app should be structured. Node ref At minimum though, you need to pass the setNodeRef function that is returned by the useDraggable hook to a DOM element so that it can access the underlying DOM node and keep track of it to detect collisions and intersections with other droppable elements. import {useDraggable} from '@dnd-kit/core' ; import {CSS} from '@dnd-kit/utilities' ; function Draggable () { const {attributes, listeners, setNodeRef, transform} = useDraggable ({ id: 'unique-id' , }); const style = { transform: CSS.T
related reading
- Getting Started - Legacy | dnd kitdocs.dndkit.com
- Drag Overlay - Legacy | dnd kitdocs.dndkit.com
- DndContext - Legacy | dnd kitdocs.dndkit.com
- Sortable - Legacy | dnd kitdocs.dndkit.com
- HTML Drag and Drop API - Web APIs | MDNdeveloper.mozilla.org
- Installation - Legacy | dnd kitdocs.dndkit.com
- Chloe's Gardenchloeyan.me
- Raindrop.ioapp.raindrop.io
- HTMLElement: drop event - Web APIs | MDNdeveloper.mozilla.org
- [dev-overlay] Make badge draggable by raunofreiberg · Pull Request #78716 · vercel/next.jsgithub.com
- Anime.js | JavaScript Animation Engineanimejs.com
- Sorrel Salb | Are.naare.na