vue-draggable-popup
v0.0.1
Published
> A lightweight, TypeScript-friendly Vue 3 library that provides a draggable, resizable popup component designed to work alongside Quasar UI (optional). Exports a plugin and named component for easy integration.
Downloads
93
Readme
Vue Draggable Popup
A lightweight, TypeScript-friendly Vue 3 library that provides a draggable, resizable popup component designed to work alongside Quasar UI (optional). Exports a plugin and named component for easy integration.
Package: vue-draggable-popup
Highlights
- TypeScript friendly: component uses
<script setup lang="ts">and ships with a TS shim. - Draggable & Resizable: native mouse/touch handlers for drag and resize.
- z-index management: simple utilities to keep popups on top.
- Small reactive store: supports single-open-popup behavior (toggle
allowMultiple).
Peer dependencies
vue^3.xquasar^2.x (only used by the component's default header markup; header slot can be used instead to avoid Quasar dependency)
Quick Install (consumer)
Install from npm:
npm install vue-draggable-popup
# Ensure your project provides Vue and (optionally) Quasar
npm install vue
npm install quasarUsage (global plugin)
// main.ts (consumer app)
import { createApp } from 'vue'
import App from './App.vue'
import VueDraggablePopup from 'vue-draggable-popup'
const app = createApp(App)
app.use(VueDraggablePopup)
app.mount('#app')Then in any component template:
<template>
<DraggablePopup v-model="show" :useHeader="true" label="Hello">
<div>Popup body content</div>
</DraggablePopup>
</template>
<script setup lang="ts">
import { ref } from 'vue'
const show = ref(true)
</script>Usage (named import)
import { DraggablePopup } from 'vue-draggable-popup'Register locally in a component if preferred.
Component API
Props
modelValue(boolean) — required. Controls visibility (v-model).useHeader(boolean) — defaultfalse. Show header area.useCustomHeader(boolean) — defaultfalse. Use thecustom_headerslot.color(string) — header background color (used when notuseCustomHeader).label(string) — header center label.hideCloseBtn(boolean) — defaultfalse.dragHandleSelector(string | null) — CSS selector to find custom drag handle inside popup.resetZIndexOnClose(boolean) — defaulttrue.minWidth,minHeight,maxWidth,maxHeight,width,height(numbers) — sizing.resizable(boolean) — defaulttrue.popupId(string | null) — identifier used by store whenallowMultipleisfalse.allowMultiple(boolean) — defaultfalse. Whenfalse, opening another popup closes the previous one.
Emits
update:modelValue(boolean) — v-model update when popup closed/opened.update:width(number) — emitted during resize.update:height(number) — emitted during resize.
Slots
default— popup content body.header— left header slot (used with default header markup).header_right_slot— right side header slot.custom_header— full custom header markup whenuseCustomHeaderis true.
Notes about Quasar
- The component's default header includes Quasar components (
q-bar,q-btn,q-tooltip). If you prefer no Quasar dependency, either:- Provide
useCustomHeaderplus thecustom_headerslot and use plain HTML/CSS for the header, or - Replace the default header markup in
src/components/DraggablePopup.vuewith your preferred UI elements.
- Provide
This project builds in Vite library mode and externalizes vue and quasar as peers.
