DraggablePanel
DraggablePanel is a panel that can be dragged and resized. It supports pinning, fixed or floating mode, placement in four directions, minimum width and height, expandable or not, default and customizable size, and destroy on close. It also provides a handler for expanding and collapsing the panel.
import { DraggablePanel } from '@lobehub/ui';Default
Layout
Stable Layout
Drag to Collapse
APIs
backgroundColorstringclassNames{ content?: string; handle?: string; }collapseThresholdnumberPreview a collapsed panel while resizing at or below this size, then commit the collapsed state on pointer release. Dragging back above the threshold before release restores the panel. Applies to width for left/right placement and height for top/bottom placement. Omit to disable drag-to-collapse behavior.
defaultExpandbooleanDefaults to
true.defaultSizePartial<Size>destroyOnClosebooleanexpandbooleanexpandablebooleanDefaults to
true.fullscreenbooleanheaderHeightnumberDefaults to
0.maxHeightnumbermaxWidthnumberminHeightnumberminWidthnumbermode'fixed' | 'float'Defaults to
"fixed".onExpandChange(expand: boolean) => voidonSizeChange(delta: NumberSize, size?: Size) => voidonSizeDragging(delta: NumberSize, size?: Size) => voidpinbooleanDefaults to
true.placementRequiredPlacementTypeDefaults to
"right".resizefalse | true | { bottom?: boolean; bottomLeft?: boolean; bottomRight?: boolean; left?: boolean; right?: boolean; top?: boolean; topLeft?: boolean; topRight?: boolean; }showBorderbooleanWhether to show border
Defaults to
true.showHandleHighlightbooleanDefaults to
false.showHandleWhenCollapsedbooleanshowHandleWideAreabooleanDefaults to
true.sizePartial<Size>stableLayoutbooleanUse two-layer container layout to keep content layout stable when collapsed/expanded.
Defaults to
false.styles{ content?: CSSProperties; handle?: CSSProperties; }
Also accepts all native HTML and ARIA attributes.