The modern, lightweight, performant, accessible and extensible drag & drop toolkit for React.
Installations
npm install @dnd-kit/modifiers
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
12.22.12
NPM Version
6.14.16
Score
93.5
Supply Chain
93.7
Quality
81.7
Maintenance
100
Vulnerability
100
License
Releases
@dnd-kit/react@0.0.9
Updated on Feb 10, 2025
@dnd-kit/dom@0.0.9
Updated on Feb 10, 2025
@dnd-kit/geometry@0.0.9
Updated on Feb 10, 2025
@dnd-kit/collision@0.0.9
Updated on Feb 10, 2025
@dnd-kit/abstract@0.0.9
Updated on Feb 10, 2025
@dnd-kit/helpers@0.0.9
Updated on Feb 10, 2025
Contributors
Languages
TypeScript (92.59%)
CSS (6.73%)
JavaScript (0.49%)
HTML (0.19%)
validate.email 🚀
Verify real, reachable, and deliverable emails with instant MX records, SMTP checks, and disposable email detection.
Developer
Download Statistics
Total Downloads
92,570,955
Last Day
300,780
Last Week
1,544,952
Last Month
6,546,493
Last Year
55,178,454
GitHub Statistics
MIT License
14,130 Stars
477 Commits
694 Forks
40 Watchers
28 Branches
49 Contributors
Updated on Mar 14, 2025
Bundle Size
2.22 kB
Minified
977.00 B
Minified + Gzipped
Package Meta Information
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
Total Downloads
Cumulative downloads
Total Downloads
92,570,955
Last Day
4%
300,780
Compared to previous day
Last Week
4.4%
1,544,952
Compared to previous week
Last Month
8.3%
6,546,493
Compared to previous month
Last Year
111.7%
55,178,454
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
2
Peer Dependencies
2
Dev Dependencies
1
@dnd-kit/modifiers
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:
- Restricting motion to a single axis
- Restricting motion to the draggable node container's bounding rectangle
- Restricting motion to the draggable node's scroll container bounding rectangle
- Applying resistance or clamping the motion
Installation
To start using modifiers, install the modifiers package via yarn or npm:
npm install @dnd-kit/modifiers
Usage
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.
Built-in modifiers
Restricting motion to an axis
restrictToHorizontalAxis
Restrict movement to only the horizontal axis.
restrictToVerticalAxis
Restrict movement to only the vertical axis.
Restrict motion to a container's bounding rectangle
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.
Snap to grid
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);
Snap to cursor
snapCenterToCursor
Snaps the center of the draggable item to the cursor when it is picked up. Has no effect when using the Keyboard sensor.
Building custom modifiers
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
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
Found 6/12 approved changesets -- score normalized to 5
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/chromatic.yml:1
- Warn: no topLevel permission defined: .github/workflows/integration.yml:1
- Warn: no topLevel permission defined: .github/workflows/lint.yml:1
- Warn: no topLevel permission defined: .github/workflows/main.yml:1
- Warn: no topLevel permission defined: .github/workflows/release-experimental.yml:1
- Warn: no topLevel permission defined: .github/workflows/release.yml:1
- Warn: no topLevel permission defined: .github/workflows/size.yml:1
- Info: no jobLevel write permissions found
Reason
0 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/chromatic.yml:9: update your workflow using https://app.stepsecurity.io/secureworkflow/clauderic/dnd-kit/chromatic.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/chromatic.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/clauderic/dnd-kit/chromatic.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/chromatic.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/clauderic/dnd-kit/chromatic.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/integration.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/clauderic/dnd-kit/integration.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/integration.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/clauderic/dnd-kit/integration.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/integration.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/clauderic/dnd-kit/integration.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lint.yml:8: update your workflow using https://app.stepsecurity.io/secureworkflow/clauderic/dnd-kit/lint.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lint.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/clauderic/dnd-kit/lint.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/lint.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/clauderic/dnd-kit/lint.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/clauderic/dnd-kit/main.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/clauderic/dnd-kit/main.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/main.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/clauderic/dnd-kit/main.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release-experimental.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/clauderic/dnd-kit/release-experimental.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/release-experimental.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/clauderic/dnd-kit/release-experimental.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/clauderic/dnd-kit/release.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/clauderic/dnd-kit/release.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:31: update your workflow using https://app.stepsecurity.io/secureworkflow/clauderic/dnd-kit/release.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:35: update your workflow using https://app.stepsecurity.io/secureworkflow/clauderic/dnd-kit/release.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/size.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/clauderic/dnd-kit/size.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/size.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/clauderic/dnd-kit/size.yml/master?enable=pin
- Info: 0 out of 12 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 8 third-party GitHubAction dependencies pinned
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 28 are checked with a SAST tool
Reason
91 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-7r3h-m5j6-3q42
- Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6
- Warn: Project is vulnerable to: GHSA-h5c3-5r3r-rr8q
- Warn: Project is vulnerable to: GHSA-rmvr-2pp2-xj38
- Warn: Project is vulnerable to: GHSA-xx4v-prfh-6cgc
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-fwr7-v2mv-hh25
- Warn: Project is vulnerable to: GHSA-4w2v-q235-vp99
- Warn: Project is vulnerable to: GHSA-cph5-m8f7-6c5x
- Warn: Project is vulnerable to: GHSA-wf5p-g6vw-rhxx
- Warn: Project is vulnerable to: GHSA-jr5f-v2jv-69x6
- Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-x9w5-v3q2-3rhw
- Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c
- Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq
- Warn: Project is vulnerable to: GHSA-434g-2637-qmqr
- Warn: Project is vulnerable to: GHSA-49q7-c7j4-3p7m
- Warn: Project is vulnerable to: GHSA-977x-g7h5-7qgw
- Warn: Project is vulnerable to: GHSA-f7q4-pwc6-w24p
- Warn: Project is vulnerable to: GHSA-fc9h-whq2-v747
- Warn: Project is vulnerable to: GHSA-vjh7-7g9h-fjfh
- Warn: Project is vulnerable to: GHSA-rv95-896h-c2vc
- Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx
- Warn: Project is vulnerable to: GHSA-74fj-2j2h-c42q
- Warn: Project is vulnerable to: GHSA-pw2r-vq6v-hr8c
- Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc
- Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp
- Warn: Project is vulnerable to: GHSA-vfrc-7r7c-w9mx
- Warn: Project is vulnerable to: GHSA-7wwv-vh3v-89cq
- Warn: Project is vulnerable to: GHSA-rc47-6667-2j5j
- Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37
- Warn: Project is vulnerable to: GHSA-78xj-cgh5-2h22
- Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp
- Warn: Project is vulnerable to: GHSA-896r-f27r-55mw
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-76p3-8jx3-jpfq
- Warn: Project is vulnerable to: GHSA-3rfm-jhwj-7488
- Warn: Project is vulnerable to: GHSA-hhq3-ff78-jv3g
- Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw
- Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm
- Warn: Project is vulnerable to: GHSA-4wx3-54gh-9fr9
- Warn: Project is vulnerable to: GHSA-xf5p-87ch-gxw2
- Warn: Project is vulnerable to: GHSA-5v2h-r2cx-5xgj
- Warn: Project is vulnerable to: GHSA-rrrm-qjm4-v8hf
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-79jw-6wg7-r9g4
- Warn: Project is vulnerable to: GHSA-r5cq-9537-9rpf
- Warn: Project is vulnerable to: GHSA-84p7-fh9c-6g8h
- Warn: Project is vulnerable to: GHSA-8hfj-j24r-96c4
- Warn: Project is vulnerable to: GHSA-wc69-rhjr-hc9g
- Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55
- Warn: Project is vulnerable to: GHSA-r683-j2x4-v87g
- Warn: Project is vulnerable to: GHSA-3j8f-xvm3-ffx4
- Warn: Project is vulnerable to: GHSA-4p35-cfcx-8653
- Warn: Project is vulnerable to: GHSA-7f3x-x4pr-wqhj
- Warn: Project is vulnerable to: GHSA-jpp7-7chh-cf67
- Warn: Project is vulnerable to: GHSA-q6wq-5p59-983w
- Warn: Project is vulnerable to: GHSA-j9fq-vwqv-2fm2
- Warn: Project is vulnerable to: GHSA-pqw5-jmp5-px4v
- Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j
- Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w
- Warn: Project is vulnerable to: GHSA-7fh5-64p2-3v2j
- Warn: Project is vulnerable to: GHSA-wvhm-4hhf-97x9
- Warn: Project is vulnerable to: GHSA-h4hr-7fg3-h35w
- Warn: Project is vulnerable to: GHSA-gj77-59wh-66hg
- Warn: Project is vulnerable to: GHSA-hqhp-5p83-hx96
- Warn: Project is vulnerable to: GHSA-3949-f494-cm99
- Warn: Project is vulnerable to: GHSA-x7hr-w5r2-h6wg
- Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp
- Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg
- Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p
- Warn: Project is vulnerable to: GHSA-w5hq-hm5m-4548
- Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36
- Warn: Project is vulnerable to: GHSA-4wf5-vphf-c2xc
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-w5p7-h5w8-2hfq
- Warn: Project is vulnerable to: GHSA-7p7h-4mm5-852v
- Warn: Project is vulnerable to: GHSA-38fc-wpqx-33j7
- Warn: Project is vulnerable to: GHSA-fhg7-m89q-25r3
- Warn: Project is vulnerable to: GHSA-wr3j-pwj9-hqq6
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
Score
3
/10
Last Scanned on 2025-03-10
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 MoreOther packages similar to @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.