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
| Prop | Description | Type | Required | Default Value |
|---|---|---|---|---|
id | Stable item id for store commands / remount. | string | false | auto UUID |
title | Title displayed in the float header. | string | false | - |
disabledExpand | Disables the expand/collapse feature. | boolean | false | false |
disabledHeader | Hides the header section. | boolean | false | false |
disabledClose | Hides the close button. | boolean | false | false |
disabledOrder | Disables drag ordering with other items. | boolean | false | false |
containerId | ID of the parent container (for teleporting). | string | false | - |
show | Controls the visibility of the float panel. | boolean | false | false |
expand | Whether the float panel is expanded. | boolean | false | false |
width | Width of the float panel. | number | false | 200 |
height | Height of the float panel. | number | false | 200 |
top | Distance from the top of the container. | number | false | - |
left | Distance from the left of the container. | number | false | - |
bottom | Distance from the bottom of the container. | number | false | - |
right | Distance from the right of the container. | number | false | - |
maxHeight | Maximum height of the float panel. | number | false | 500 |
headerLocation | Location of the header: 'top' or 'bottom'. | string | false | 'top' |
Events
| Name | Description |
|---|---|
update:expand | Emitted when the expand state changes. Payload: (value:boolean) |
close | Emitted when the float panel is closed. Payload: () |
update:show | Emitted 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.
| Vue | React | Description |
|---|---|---|
default | children | Content of the float panel. |
title | title | Title text or custom title node (ReactNode | string). |
after-title | afterTitle | Immediately after title (before spacer). |
extra-btn | extraBtn | Trailing 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.