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

dnd-multi-backend

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dnd-multi-backend

Multi Backend system compatible with DnD Core / React DnD

  • 8.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
126K
increased by10.2%
Maintainers
1
Weekly downloads
 
Created

What is dnd-multi-backend?

The dnd-multi-backend package is a flexible and powerful library for handling drag-and-drop interactions in React applications. It allows developers to use multiple backends (such as HTML5 and touch) to provide a seamless drag-and-drop experience across different devices and environments.

What are dnd-multi-backend's main functionalities?

Multi-backend support

This feature allows you to use multiple drag-and-drop backends in a single application. The code sample demonstrates how to set up the DndProvider with the MultiBackend and configure it to use both HTML5 and touch backends.

import { DndProvider } from 'react-dnd';
import { HTML5Backend } from 'react-dnd-html5-backend';
import { TouchBackend } from 'react-dnd-touch-backend';
import MultiBackend from 'dnd-multi-backend';
import { HTML5toTouch } from 'dnd-multi-backend/lib/HTML5toTouch';

const App = () => (
  <DndProvider backend={MultiBackend} options={HTML5toTouch}>
    {/* Your drag-and-drop components go here */}
  </DndProvider>
);

Custom backend configuration

This feature allows you to customize the configuration of the backends used in your application. The code sample shows how to create a custom transition and configure the HTML5 and touch backends with specific options.

import { DndProvider } from 'react-dnd';
import MultiBackend, { createTransition } from 'dnd-multi-backend';
import { HTML5Backend } from 'react-dnd-html5-backend';
import { TouchBackend } from 'react-dnd-touch-backend';

const HTML5toTouch = {
  backends: [
    {
      backend: HTML5Backend,
      transition: createTransition('touchstart', (event) => event.touches != null)
    },
    {
      backend: TouchBackend,
      options: { enableMouseEvents: true },
      preview: true
    }
  ]
};

const App = () => (
  <DndProvider backend={MultiBackend} options={HTML5toTouch}>
    {/* Your drag-and-drop components go here */}
  </DndProvider>
);

Other packages similar to dnd-multi-backend

Keywords

FAQs

Package last updated on 21 Sep 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