Skip to content

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
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)

Slots

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

Usage

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

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