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
idStable item id for store commands / remount.stringfalseauto UUID
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
highlightMsHow long highlight stays on (ms).numberfalse5000
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)
update:boundsEmitted on drag/resize stop. Payload: {x,y,width,height}

React: use onUpdateShow / onUpdateExpand / onClose / onBoundsChange.

Prefer v-model:show (Vue) or controlled show + onUpdateShow (React) so store-driven open/close stays in sync.

Slots ​

Header layout: [ pre-title ] [ title | after-title ] …… spacer …… [ extra-btn ]. Full contract: header-slots.md.

VueReactDescription
defaultchildrenContent of the popup.
pre-titlepreTitleBefore the title group.
titletitleTitle text or custom title node (ReactNode | string).
after-titleafterTitleImmediately after title (before spacer).
extra-btnextraBtnTrailing header actions after the spacer.

Usage ​

Vue ​

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

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

React ​

tsx
import { DraggableContainer, DraggableItemPopup } from '@hungpvq/react-draggable';

export function Example() {
  return (
    <DraggableContainer>
      <DraggableItemPopup title="Title" show top={10} left={410} width={300} height={400}>
        <div style={{ height: '100vh' }} />
      </DraggableItemPopup>
    </DraggableContainer>
  );
}

Accessibility ​

Non-modal role="dialog" + aria-labelledby; Escape closes when focus is inside the panel; expand uses aria-expanded. Icon-only chrome is labelled. Keyboard drag/resize is out of scope. See a11y.md.