Skip to content

DraggableItemPopup

Overview

DraggableItemPopup provides a draggable popup window that can be positioned anywhere within the container. It is suitable for dialogs, notifications, or any floating content that needs to be moved by the user.

Props

PropDescriptionTypeRequiredDefault Value
titleTitle displayed in the popup header.stringfalse-
disabledExpandDisables the expand/collapse feature.booleanfalsefalse
disabledHeaderHides the header section.booleanfalsefalse
disabledCloseHides the close button.booleanfalsefalse
disabledOrderDisables drag ordering with other items.booleanfalsefalse
containerIdID of the parent container (for teleporting).stringfalse-
showControls the visibility of the popup.booleanfalsefalse
expandWhether the popup is expanded.booleanfalsefalse
widthWidth of the popup.numberfalse200
heightHeight of the popup.numberfalse200
topDistance from the top of the container.numberfalse-
leftDistance from the left of the container.numberfalse-
bottomDistance from the bottom of the container.numberfalse-
rightDistance from the right of the container.numberfalse-
centerXCenter the popup horizontally.booleanfalsefalse
centerYCenter the popup vertically.booleanfalsefalse
centerCenter the popup both horizontally and vertically.booleanfalsefalse

Events

NameDescription
update:expandEmitted when the expand state changes. Payload: (value:boolean)
closeEmitted when the popup is closed. Payload: ()
update:showEmitted when the visibility changes. Payload: (value:boolean)

Slots

NameDescription
defaultContent of the popup.
titleCustom content for the header area.
extra-btnExtra buttons in the header.

Usage

vue
<script setup lang="ts">
import { DraggableContainer, DraggableItemPopup } from '@hungpvq/vue-draggable';
</script>

<template>
  <DraggableContainer>
    <DraggableItemPopup title="Title" show :top="10" :left="410">
      <div style="height: 100vh"></div>
    </DraggableItemPopup>
  </DraggableContainer>
</template>