Make Your Vue Components Draggable Library Using Vue2/3 | revue draggable

Revue-draggable supports Vue 2 and Vue 3! It comes with batteries 🔋 built-in component/routing/configurable or for users who want more control over a simple abstraction over pull events with the kernel, which is also available as a component/routing/configurable.

Features

  • Make any element (including SVG) draggable
  • Use Core to get full control
  • Built to configure
  • Supports Vue2 and Vue3! Not a problem!

How to make use of it:

Install and download:

# Yarn
$ yarn add @braks/revue-draggable

# NPM
$ npm i @braks/revue-draggable --save

1. Import and record Revue Draggable.

// Vue 3
import { createApp } from 'vue';
import Draggable, { DraggablePlugin, DraggableDirective } from '@braks/revue-draggable';
const app = createApp();
// As Plugin
app.use(DraggablePlugin);
// or
app.directive('draggable', DraggableDirective)
app.component('Draggable', Draggable);
app.mount('#root');
// Vue 2
import Vue from 'vue';
import { DraggablePlugin, DraggableDirective } from '@braks/revue-draggable';
// As Plugin
Vue.use(DraggablePlugin)
// or
Vue.directive('draggable', DraggableDirective)
Vue.component('Draggable', Draggable)

2. Use Revue Draggable as a directive or component.

<template>
  <div v-draggable="props" class="box">
    ...
  </div>
</template>
<template>
  <Draggable>
    <div class="box">
      ...
    </div>
  </Draggable>
</template>

3. Props are available.

axis: {
  type: String as PropType<DraggableOptions['axis']>,
  default: 'both'
},
bounds: {
  type: [Object, String, Boolean] as PropType<DraggableOptions['bounds']>,
  default: false
},
defaultClassName: {
  type: String as PropType<DraggableOptions['defaultClassName']>,
  default: 'revue-draggable'
},
defaultClassNameDragging: {
  type: String as PropType<DraggableOptions['defaultClassNameDragging']>,
  default: 'revue-draggable-dragging'
},
defaultClassNameDragged: {
  type: String as PropType<DraggableOptions['defaultClassNameDragged']>,
  default: 'revue-draggable-dragged'
},
defaultPosition: {
  type: Object as PropType<DraggableOptions['defaultPosition']>,
  default: () => ({ x: 0, y: 0 })
},
scale: {
  type: Number as PropType<DraggableOptions['scale']>,
  default: 1
},
position: {
  type: Object as PropType<DraggableOptions['position']>,
  default: undefined
},
positionOffset: {
  type: Object as PropType<DraggableOptions['positionOffset']>,
  default: undefined
},
allowAnyClick: {
  type: Boolean as PropType<DraggableOptions['allowAnyClick']>,
  default: true
},
disabled: {
  type: Boolean as PropType<DraggableOptions['disabled']>,
  default: false
},
enableUserSelectHack: {
  type: Boolean as PropType<DraggableOptions['enableUserSelectHack']>,
  default: true
},
cancel: {
  type: String as PropType<DraggableOptions['cancel']>,
  default: undefined
},
offsetParent: {
  type: Object as PropType<DraggableOptions['offsetParent']>,
  default: () => {}
},
grid: {
  type: Array as unknown as PropType<DraggableOptions['grid']>,
  default: undefined
},
handle: {
  type: String as PropType<DraggableOptions['handle']>,
  default: undefined
},
start: {
  type: Function as PropType<DraggableOptions['start']>,
  default: () => {}
},
move: {
  type: Function as PropType<DraggableOptions['move']>,
  default: () => {}
},
stop: {
  type: Function as PropType<DraggableOptions['stop']>,
  default: () => {}
}

Make Components Draggable, revue draggable Plugin/Github


See Demo And Download

Official Website(bcakmakoglu): Click Here

This superior jQuery/javascript plugin is developed by bcakmakoglu. For extra Advanced Usages, please go to the official website.

Related Posts

Fullscreen-Lightbox-Plugin

Simple And Powerful Fullscreen Lightbox Plugin | fslightbox

Fullscreen Lightbox Basic is a modern and handy plug-in for displaying photos and videos in a clean overlay box. Showcase a single source or create a great…

product-thumbnail-slider-with-zoom-effect-jquery

Product Thumbnail Slider With Positive Zoom Effect jQuery

Positive Zoom is a JavaScript library for creating an image gallery where you can zoom in on the current image by hovering over it. Must Read: Pure…

CSS-Gauge-Meter

Create Responsive Gauge Meter Using Pure CSS | CSSGauge

Pure CSS Gauge Meter Component, no SVG, or artboard is used in this component. This component can be easily distinguished by overriding the default style rules and…

bulma-datepicker

Versatile Date and Time Picker Calendar for Bulma

Bulma extension for calendar display can be used on a page as a large calendar with appointments or as a date picker/popup window. A responsive, customizable, and…

javascript-time-series-chart-library

Simple Time-Series Chart Viewer with HTML5 Canvas Javascript Library

Pixl chart library displays time series charts in the browser, using the HTML5 Canvas element. It is designed to be lightweight and efficient, while still providing a…

Neumorphic-Design-CSS

Neumorphic Design Inspiration Style CSS Shapes | Neumorphism

Multi-dimensional design is inspired by the physical world and adds textures, reflection, shadows, layers, and depths to the flat design making the UI elements more visible. CSS…