A directive that catches pointer events and emits drag events.
This won't move the element, it just emits events when the user does a drag gesture.
<div (duiDrag)="onDrag($event)" [duiDragThreshold]="2"></div>
The directive DragDirective
allows to listen to drag gestures on an element. It can be used to implement custom drag and drop functionality, to create resizable elements, or to implement custom drag interactions.
This example uses another directive duiPositionChange
which uses observePosition
to monitor arbitrary element position and size changes (using efficient IntersectObserver and ResizeObserver).
[duiDrag]
(source)A directive that catches pointer events and emits drag events.
This won't move the element, it just emits events when the user does a drag gesture.
<div (duiDrag)="onDrag($event)" [duiDragThreshold]="2"></div>
The component dui-splitter
is tailored for resizing layouts, such as sidebars or panels.
Use [element]
to safely set the [property]
of the element. It makes sure that [size]
it the real size of the element after drag ended. Use instead or additionally [size] with (sizeChange) to persist and load the size in e.g. localStorage.
<dui-splitter>
(source)A splitter component that can be used for layout resizing. With an indicator that shows a handle.
This is typically used to resize layouts such as sidebars, panels, or other UI elements.
Best used in combination with flex-basis CSS property to allow flexible resizing.
<div class="layout"> <div class="sidebar" [style.flex-basis.px]="sidebarSize()"> <dui-splitter position="right" [size]="sidebarSize" (sizeChange)="sidebarSize.set($event)" indicator></dui-splitter> </div> <div class="content"></div> </div>