Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@dnd-kit/modifiers

Package Overview
Dependencies
Maintainers
1
Versions
93
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dnd-kit/modifiers

Translate modifier presets for use with `@dnd-kit` packages.

  • 7.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1M
increased by0.15%
Maintainers
1
Weekly downloads
 
Created

What is @dnd-kit/modifiers?

@dnd-kit/modifiers is a package that provides a set of utilities to modify the behavior of drag-and-drop interactions in the @dnd-kit library. It allows you to constrain, restrict, and customize the dragging experience in various ways.

What are @dnd-kit/modifiers's main functionalities?

Restrict Movement

This feature allows you to restrict the movement of draggable items to the horizontal axis only. By using the `restrictToHorizontalAxis` modifier, you can ensure that items can only be dragged left or right.

import { restrictToHorizontalAxis } from '@dnd-kit/modifiers';

const modifiers = [restrictToHorizontalAxis];

<DndContext modifiers={modifiers}>
  {/* Your draggable components here */}
</DndContext>;

Restrict to Parent Bounds

This feature restricts the movement of draggable items to the bounds of their parent element. The `restrictToParentElement` modifier ensures that items cannot be dragged outside their parent container.

import { restrictToParentElement } from '@dnd-kit/modifiers';

const modifiers = [restrictToParentElement];

<DndContext modifiers={modifiers}>
  {/* Your draggable components here */}
</DndContext>;

Snap to Grid

This feature allows you to snap draggable items to a grid. By using the `snapToGrid` modifier with specified grid dimensions, you can ensure that items snap to the nearest grid point when dragged.

import { snapToGrid } from '@dnd-kit/modifiers';

const modifiers = [snapToGrid({ x: 20, y: 20 })];

<DndContext modifiers={modifiers}>
  {/* Your draggable components here */}
</DndContext>;

Other packages similar to @dnd-kit/modifiers

FAQs

Package last updated on 06 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc