Skip to content

DraggableItemSideBar

Overview

DraggableItemSideBar creates a sidebar panel that can be dragged and expanded/collapsed. It is ideal for navigation menus or tool panels that need to be shown or hidden dynamically and repositioned by the user.

Props

PropDescriptionTypeRequiredDefault Value
showControls the visibility of the sidebar.booleanfalsefalse
expandWhether the sidebar is expanded.booleanfalsefalse
widthWidth of the sidebar.number,stringfalse'auto'
locationSidebar position: 'left', 'right', 'top', 'bottom'.stringfalse'left'
titleTitle displayed in the sidebar 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-

Events

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

Slots

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

Usage

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

<template>
  <DraggableContainer>
    <DraggableItemSideBar title="Title" show right>
      <div style="height: 100vh"></div>
    </DraggableItemSideBar>
  </DraggableContainer>
</template>