Gathering detailed insights and metrics for @dnd-kit/modifiers
Gathering detailed insights and metrics for @dnd-kit/modifiers
Gathering detailed insights and metrics for @dnd-kit/modifiers
Gathering detailed insights and metrics for @dnd-kit/modifiers
@dnd-kit-vue/modifiers
Translate modifier presets for use with `@dnd-kit` packages.
@thohui/dnd-kit-modifiers
Translate modifier presets for use with `@dnd-kit` packages.
@dnd-kit-svelte/modifiers
[](https://npm.im/@dnd-kit-svelte/modifiers)
@alissavrk/dnd-kit-modifiers
Translate modifier presets for use with `@dnd-kit` packages.
The modern, lightweight, performant, accessible and extensible drag & drop toolkit for React.
npm install @dnd-kit/modifiers
Typescript
Module System
Node Version
NPM Version
93.3
Supply Chain
92.3
Quality
81.7
Maintenance
100
Vulnerability
100
License
@dnd-kit/collision@0.1.17
Updated on May 22, 2025
@dnd-kit/dom@0.1.17
Updated on May 22, 2025
@dnd-kit/geometry@0.1.17
Updated on May 22, 2025
@dnd-kit/abstract@0.1.17
Updated on May 22, 2025
@dnd-kit/state@0.1.17
Updated on May 22, 2025
@dnd-kit/react@0.1.17
Updated on May 22, 2025
TypeScript (92.59%)
CSS (6.73%)
JavaScript (0.49%)
HTML (0.19%)
Total Downloads
108,829,796
Last Day
342,127
Last Week
1,779,322
Last Month
7,183,428
Last Year
62,889,733
MIT License
14,691 Stars
477 Commits
731 Forks
39 Watchers
29 Branches
49 Contributors
Updated on May 23, 2025
Minified
Minified + Gzipped
Latest Version
9.0.0
Package Id
@dnd-kit/modifiers@9.0.0
Unpacked Size
47.85 kB
Size
11.03 kB
File Count
21
NPM Version
6.14.16
Node Version
12.22.12
Published on
Dec 04, 2024
Cumulative downloads
Total Downloads
Last Day
5.8%
342,127
Compared to previous day
Last Week
5.5%
1,779,322
Compared to previous week
Last Month
5%
7,183,428
Compared to previous month
Last Year
102.5%
62,889,733
Compared to previous year
2
2
1
Modifiers let you dynamically modify the movement coordinates that are detected by sensors. They can be used for a wide range of use cases, for example:
To start using modifiers, install the modifiers package via yarn or npm:
npm install @dnd-kit/modifiers
The modifiers repository contains a number of useful modifiers that can be applied on DndContext
as well as DragOverlay
.
1import {DndContext, DragOverlay} from '@dnd-kit'; 2import { 3 restrictToVerticalAxis, 4 restrictToWindowEdges, 5} from '@dnd-kit/modifiers'; 6 7function App() { 8 return ( 9 <DndContext modifiers={[restrictToVerticalAxis]}> 10 {/* ... */} 11 <DragOverlay modifiers={[restrictToWindowEdges]}>{/* ... */}</DragOverlay> 12 </DndContext> 13 ); 14}
As you can see from the example above, DndContext
and DragOverlay
can both have different modifiers.
restrictToHorizontalAxis
Restrict movement to only the horizontal axis.
restrictToVerticalAxis
Restrict movement to only the vertical axis.
restrictToWindowEdges
Restrict movement to the edges of the window. This modifier can be useful to prevent the DragOverlay
from being moved outside of the bounds of the window.
restrictToParentElement
Restrict movement to the parent element of the draggable item that is picked up.
restrictToFirstScrollableAncestor
Restrict movement to the first scrollable ancestor of the draggable item that is picked up.
createSnapModifier
Function to create modifiers to snap to a given grid size.
1import {createSnapModifier} from '@dnd-kit/modifiers'; 2 3const gridSize = 20; // pixels 4const snapToGridModifier = createSnapModifier(gridSize);
snapCenterToCursor
Snaps the center of the draggable item to the cursor when it is picked up. Has no effect when using the Keyboard sensor.
To build your own custom modifiers, refer to the implementation of the built-in modifiers of this package.
For example, here is an implementation to create a modifier to snap to grid:
1const gridSize = 20; 2 3function snapToGrid(args) { 4 const {transform} = args; 5 6 return { 7 ...transform, 8 x: Math.ceil(transform.x / gridSize) * gridSize, 9 y: Math.ceil(transform.y / gridSize) * gridSize, 10 }; 11}
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 6/12 approved changesets -- score normalized to 5
Reason
0 commit(s) and 7 issue activity found in the last 90 days -- score normalized to 5
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
91 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-05-19
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More