Skip to content
Docs version
@hungpvq/draggable@1.3.1@hungpvq/vue-draggable@1.3.1@hungpvq/react-draggable@1.3.1

DraggableItemFloat

Overview

DraggableItemFloat provides a floating, draggable panel that can be positioned anywhere within the container. It is ideal for tool palettes, floating controls, or any UI element that should be freely movable and optionally docked to a side or corner.

Props

PropDescriptionTypeRequiredDefault Value
idStable item id for store commands / remount.stringfalseauto UUID
titleTitle displayed in the float 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 float panel.booleanfalsefalse
expandWhether the float panel is expanded.booleanfalsefalse
widthWidth of the float panel.numberfalse200
heightHeight of the float panel.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-
maxHeightMaximum height of the float panel.numberfalse500
headerLocationLocation of the header: 'top' or 'bottom'.stringfalse'top'

Events

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

React: use onUpdateShow / onUpdateExpand / onClose.

Slots

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

VueReactDescription
defaultchildrenContent of the float panel.
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, DraggableItemFloat } from '@hungpvq/vue-draggable';
</script>

<template>
  <DraggableContainer>
    <DraggableItemFloat title="Title" show :right="10" :bottom="10" :width="400" headerLocation="bottom">
      <div style="height: 100vh"></div>
    </DraggableItemFloat>
  </DraggableContainer>
</template>

React

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

export function Example() {
  return (
    <DraggableContainer>
      <DraggableItemFloat
        title="Title"
        show
        right={10}
        bottom={10}
        width={400}
        headerLocation="bottom"
      >
        <div style={{ height: '100vh' }} />
      </DraggableItemFloat>
    </DraggableContainer>
  );
}

Accessibility

Same non-modal dialog pattern as popup (Escape, focus restore, labelled chrome). Keyboard drag/resize is out of scope. See a11y.md.