New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

vue-draggable

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-draggable

Vuejs 2.0 directive for drag and drop

  • 1.0.0-rc.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5.3K
decreased by-9.17%
Maintainers
1
Weekly downloads
 
Created
Source

vue-draggable

Description

Vuejs 2.0 directive for drag and drop

Native HTML5 drag and drop implementation made for Vue

Installation

npm install --save vue-draggable

Install the plugin into Vue:

import Vue from 'vue'
import VueDraggable from 'vue-draggable'

Vue.use(VueDraggable)

Usage

In the template, use the v-draggable directive:

HTML

<div v-drag-and-drop:options="options">
  <ul>
    <li>Item 1</li>
    <li>Item 2</li>
    <li>Item 3</li>
  </ul>
  <ul>
      <li>Item 4</li>
      <li>Item 5</li>
      <li>Item 6</li>
  </ul>
</div>

Options

{
  dropzoneSelector: 'ul',
  draggableSelector: 'li',
  excludeOlderBrowsers: true,
  multipleDropzonesItemsDraggingEnabled: true,
  onDrop: function(event) {},
  onDragstart: function(event) {},
  onDragend: function(event) {}
}

// onDrop, onDragstart and onDragend events
{
  nativeEvent: {}, // native js event
  items: [], // list of selected draggable elements
  droptarget: null, // onDrop callback return drop element
  owner: null // owner drop element of selectet draggable element
}

CSS

/* draggable targets */
ul
{
  float:left;
  list-style-type:none;

  overflow-y:auto;

  /*margin:0 0.5em 0.5em 0;*/
  /*padding:0.5em;*/

  border:2px solid #888;
  border-radius:0.2em;

  background:#ddd;
  color:#555;
}

/* drop target state */
ul[aria-dropeffect="move"]
{
  border-color:#68b;

  background:#fff;
}

/* drop target focus and dragover state */
ul[aria-dropeffect="move"]:focus,
ul[aria-dropeffect="move"].dragover
{
  outline:none;

  box-shadow:0 0 0 1px #fff, 0 0 0 3px #68b;
}

/* draggable items */
li
{
  display:block;
  list-style-type:none;

  margin:0 0 2px 0;
  padding:0.2em 0.4em;

  border-radius:0.2em;

  line-height:1.3;
}

/* items focus state */
li:focus
{
  outline:none;

  box-shadow:0 0 0 2px #68b, inset 0 0 0 1px #ddd;
}

/* items grabbed state */
li[aria-grabbed="true"]
{
  background:#8adccc;
  color:#fff;
}

LICENCE MIT - Created by Nikola Spalevic (nikolaspalevic@gmail.com)

Keywords

FAQs

Package last updated on 31 May 2017

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