#API overview
Everything is exported from ngx-virtual-dnd. Most apps only use the exports in the first two tables.
#Start here
| Export | Use it to |
|---|---|
VirtualSortableListComponent (<vdnd-sortable-list>) | Render a sortable virtual list: droppable, scroller and placeholder in one |
DraggableDirective ([vdndDraggable]) | Make an item draggable |
DroppableGroupDirective ([vdndGroup]) | Name the group that lets lists exchange items |
DragPreviewComponent (<vdnd-drag-preview>) | Render the element that follows the pointer (place it once) |
DropEvent | Read where an item came from and where it was dropped |
moveItem, reorderItems, applyMove | Apply a drop to your signals or immutable state |
#Events and helpers
| Export | Use it to |
|---|---|
DragStartEvent | React to a drag starting ((dragStart) on a draggable) |
DragEndEvent | React to every drag ending, dropped or not ((dragEnd) on a draggable) |
PlaceholderMoveEvent | Give feedback on every placeholder step (haptics, announcements) |
isNoOpDrop, insertAt, removeAt | Skip drops back to the same place, or edit arrays immutably |
DragStateService | Read the current drag anywhere in the app, as signals |
VDND_ANIMATION_CONFIG | Turn on shift and drop animations |
AutoScrollConfig | Type of the autoScrollConfig input |
#Other list building blocks
Use these instead of <vdnd-sortable-list> when you need your own markup or page-level scrolling. See Choosing a component.
| Export | Use it to |
|---|---|
DroppableDirective ([vdndDroppable]) | Make your own element a drop target |
VirtualScrollContainerComponent (<vdnd-virtual-scroll>) | Virtual scroller inside a vdndDroppable, with scrolling methods |
ScrollableDirective ([vdndScrollable]) | Mark the element that scrolls, for page-level scrolling |
VirtualContentComponent (<vdnd-virtual-content>) | Virtual rows inside a vdndScrollable |
ContentHeaderDirective ([vdndContentHeader]) | Measure a header above the rows of <vdnd-virtual-content> |
VirtualForDirective (*vdndVirtualFor) | Render only the visible items, as a structural directive |
VirtualViewportComponent (<vdnd-virtual-viewport>) | Self-scrolling container for *vdndVirtualFor |
#Advanced
Most apps never need these. They exist for custom containers and low-level integrations.
| Export | What it is |
|---|---|
AutoScrollService | Edge scrolling during drags |
PositionCalculatorService, ElementCloneService, KeyboardDragService, OverlayContainerService | Internals exported for customization |
PlaceholderComponent (<vdnd-placeholder>) | A drop indicator you render yourself; the built-in lists do not use it |
DragPlaceholderComponent (<vdnd-drag-placeholder>) | The placeholder the built-in lists render |
VirtualScrollStrategy, FixedHeightStrategy, DynamicHeightStrategy | Virtual scroll math, for building your own container |
VDND_SCROLL_CONTAINER, VDND_VIRTUAL_VIEWPORT, VDND_GROUP_TOKEN | Tokens the library's containers provide |
| Template contexts and drag state types | Types of template variables and of DragStateService values |
END_OF_LIST, INITIAL_DRAG_STATE | Constants. END_OF_LIST is deprecated |