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.

Only one sidebar is visible per edge. If several sidebars share the same location, the active panel shows a menu button to switch between them. Switcher labels come from the title string stored in the drag store — always pass title even when using a custom #title / titleNode for the header.

Props ​

PropDescriptionTypeRequiredDefault Value
idStable item id for store commands / remount.stringfalseauto UUID
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'
titlePlain title for switcher store and default header.stringfalse-
titleNodeReact only: custom header node (Vue #title slot). Falls back to title.ReactNodefalse-
disabledExpandDisables the expand/collapse feature.booleanfalsefalse
disabledHeaderHides the header section.booleanfalsefalse
disabledCloseHides the close button.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)

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 sidebar.
title (prop)titlePlain string for the switcher menu and default header.
title (slot)titleNodeCustom header title node; falls back to title.
after-titleafterTitleImmediately after title (before spacer).

Usage ​

Vue ​

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

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

React ​

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

export function Example() {
  return (
    <DraggableContainer>
      <DraggableItemSideBar title="Title" show location="right">
        <div style={{ height: '100vh' }} />
      </DraggableItemSideBar>
    </DraggableContainer>
  );
}

Accessibility ​

role="complementary" + aria-labelledby; Escape closes when focus is in the shell; switcher menu ARIA + focus restore. See a11y.md.