Socket
Book a DemoInstallSign in
Socket

vue3-resizable

Package Overview
Dependencies
Maintainers
0
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue3-resizable

Vue3 is used for components with resizable and draggable elements.

1.0.0-alpha.3
latest
npmnpm
Version published
Weekly downloads
105
90.91%
Maintainers
0
Weekly downloads
 
Created
Source

vue3-resizable

vue3-resizable is a component based on Vue 3 that provides resizing and dragging features, allowing users to customize the size and position of elements through simple drag operations. It effectively handles touch events in combination with the any-touch library, making it suitable for both PC and mobile touch devices. 🚀

🐳 Vue 3 Composition API

🔥 Written in TypeScript

English · 简体中文 · Demo/Document

Installation

Install using npm:

npm install vue3-resizable

Install using pnpm:

pnpm install vue3-resizable

Or using yarn:

yarn add vue3-resizable

Usage

First, ensure that you import the component in your Vue project:

Global Import

import { createApp } from "vue"
import App from "./App.vue"

import LResize from "vue3-resizable"
import "vue3-resizable/dist/index.css"

const app = createApp(App)
app.use(LResize)
app.mount("#app")

Local Import

import { LResize } from "vue3-resizable"
import "vue3-resizable/dist/index.css"

Then, use it in your component:

<template>
  <LResize
    :minWidth="100"
    :minHeight="100"
    :maxWidth="300"
    :maxHeight="300"
    :initialWidth="150"
    :initialHeight="150"
    :initialTop="50"
    :initialLeft="50"
    :cssUnit="'px'"
    :showDimension="true"
    :showPosition="true"
  >
    <!-- You can insert any custom content here -->
    <div>Resizable content container</div>
  </LResize>
</template>

Props

Prop类型默认值描述
minWidthnumber30Minimum width limit
minHeightnumber30Minimum height limit
maxWidthnumbernoneMaximum width limit
maxHeightnumbernoneMaximum height limit
initialWidthnumber200Initial width
initialHeightnumber200Initial height
initialTopnumber100Initial top offset
initialLeftnumber100Initial left offset
cssUnit'px' | 'rem' | string'px'Size unit
showDimensionbooleanfalseShow size info
showPositionbooleanfalseShow position info
styleCSSProperties{}Container style
handleStyleCSSProperties{}Drag handle style

Slots

Slot NameDescription
defaultInsert custom content

Events

Event NameDescriptionParameters
boxUpdatedTriggered when the box size or position is updatedBoxState

BoxState Parameters

Parameter NameTypeDescription
widthnumberWidth of the box
heightnumberHeight of the box
topnumberTop position of the box
leftnumberLeft position of the box
zIndexnumberz-index value of the box

Exposes

Method NameDescriptionParameters
updateBoxStyleUpdate box style() => void
startDragStart dragging() => void
endDragEnd dragging() => void
startResizeStart resizing() => void
endResizeEnd resizing() => void

Developer Guide

To contribute to the development of this component, you can clone the source code repository and install all dependencies:

git clone https://github.com/LostElkByte/vue3-resizable.git
cd vue3-resizable
npm install

Contribution

Contributions are welcome through Issues or Pull Requests. Please ensure your code follows the project's style and quality standards.

License

This project is licensed under the MIT License. For more information, please see the LICENSE file.

Keywords

vue

FAQs

Package last updated on 20 Oct 2024

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.