npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

vue-drag-and-resize

v1.0.3

Published

Vue3 component that can be dragged and resized

Readme

Vue component which can be moved around and resized

Table of Contents


Install and basic usage

Install

$ npm install vue-drag-and-resize

Register the component globally

// main.js
import { createApp } from 'vue'
import 'vue-drag-and-resize/vue-drag-and-resize.css'
import VueDragAndResize from 'vue-drag-and-resize'
import App from './App.vue'

const app = createApp(App)
app.component('VueDragAndResize', VueDragAndResize)
app.mount('#app')

Register the component locally

<script setup lang="ts">
import VueDragAndResize from 'vue-drag-and-resize'
</script>

<template>
  <VueDragAndResize :width="200" :height="200">
</template>

<style scoped>
@import 'vue-drag-and-resize/vue-drag-and-resize.css';
</style>

Live Playground

For examples of the component go to the live playground

Props

alwaysOnTop

Type: Boolean Required: false Default: true

Components with AlwaysOnTop set to true will be brought to top (z-index set to 99999) when interacted with. Others with AlwaysOnTop will then have their z-index adjusted to keep order.

<VueDragAndResize :always-on-top="true"></VueDragAndResize>

buttomGutter

Type: Number Required: false Default: 0

The distance (in px) from the bottom of the parent that the component can go.

<VueDragAndResize :buttom-gutter="20"></VueDragAndResize>

dragDirections

Type: Array<String> Required: false Default: ['x', 'y'] Options: x, y

The directions in which the component and be moved.

<VueDragAndResize :drag-directions="['x','y']"></VueDragAndResize>

draggable

Type: Boolean Required: false Default: true

If the component is draggable

<VueDragAndResize :draggable="true"></VueDragAndResize>

dragOn

Type: string Required: false Default: ``

CSS selector for the element within the component to drag on. Defaults to '', or the component itself.

<VueDragAndResize :dragOn="#ElemDiv"></VueDragAndResize>

grabWidth

Type: Number Required: false Default: 0

The buffer from the edge where a grab resize grab can happen (in px)

<VueDragAndResize :grab-width="5"></VueDragAndResize>

height

Type: Number Required: false Default: -1

The starting height of the component (in px). A value of -1 will cause a calculation based on 'auto'

<VueDragAndResize :height="250"></VueDragAndResize>

left

Type: Number Required: false Default: '0'

The starting left position of the component (in px).

<VueDragAndResize :left="250"></VueDragAndResize>

leftGutter

Type: Number Required: false Default: 0

The distance (in px) from the left of the parent that the component can go.

<VueDragAndResize :left-gutter="20"></VueDragAndResize>

position

Type: String Required: false Default: absolute Options: absolute, relative

The CSS position mode for the component. If absolute, and nested in another VueDragAndResize, it will still be bound by the parents borders

<VueDragAndResize :position="absolute"></VueDragAndResize>

resizeable

Type: Boolean Required: false Default: true

If the component is resizeable.

<VueDragAndResize :resizable="true"></VueDragAndResize>

resizeDirections

Type: Array<String> Required: false Default: ['l', 'r', 'u', 'd', 'ul', 'ur', 'dl', 'dr'] Options: 'l', 'r', 'u', 'd', 'ul', 'ur', 'dl', 'dr'

The directions in which the component and be resized.

<VueDragAndResize :resize-directions="['l', 'r', 'u', 'd', 'ul', 'ur', 'dl', 'dr']"></VueDragAndResize>

rightGutter

Type: Number Required: false Default: 0

The distance (in px) from the right of the parent that the component can go.

<VueDragAndResize :right-gutter="20"></VueDragAndResize>

top

Type: Number Required: false Default: '0'

The starting top position of the component (in px).

<VueDragAndResize :top="250"></VueDragAndResize>

topGutter

Type: Number Required: false Default: 0

The distance (in px) from the top of the parent that the component can go.

<VueDragAndResize :top-gutter="20"></VueDragAndResize>

width

Type: Number Required: false Default: -1

The starting width of the component (in px). A value of -1 will cause a calculation based on 'auto'

<VueDragAndResize :width="250"></VueDragAndResize>

Events

dragging

Response

{
    start: {
        x: Number,
        y: number
    },
    end: {
        x: Number,
        y: number
    }
}

Called whenever the component starts being dragged.

<VueDragAndResize @dragging="onDragging">

drag-start

Called whenever the component gets dragged.

<VueDragAndResize @drag-start="onDragStart">

drag-end

Called whenever the component finishes being dragged.

<VueDragAndResize @drag-end="onDragEnd">

resizing

Response

{
    start: {
        x: Number,
        y: number
    },
    end: {
        x: Number,
        y: number
    }
}

Called whenever the component starts being dragged.

<VueDragAndResize @resizing="onResizing">

resize-start

Called whenever the component gets dragged.

<VueDragAndResize @resize-start="onResizeStart">

resize-end

Called whenever the component finishes being dragged.

<VueDragAndResize @resize-end="onResizeEnd">

License

The ISC License (ISC). Please see License File for more information.