JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 51
  • Score
    100M100P100Q81446F

**Advanced & blazing-fast Angular Drag & Drop Toolkit** โ€” Grid, Sort, Resize, Nesting, and more!

Package Exports

  • ngx-drag-drop-kit
  • ngx-drag-drop-kit/package.json
  • ngx-drag-drop-kit/styles

Readme

๐Ÿš€ ngx-drag-drop-kit

Advanced & blazing-fast Angular Drag & Drop Toolkit โ€” Grid, Sort, Resize, Nesting, and more!

npm version GitHub stars Sponsor

Live Demo

โœจ Features

  • ๐Ÿ–ฑ๏ธ Advanced Drag & Drop with multi-list and cross-list support
  • ๐Ÿงฉ Configurable & Responsive Grid Layout
  • ๐Ÿ“ Resizable: Resize items with mouse
  • ๐Ÿ”„ Sortable List: Reorder items via Drag & Drop
  • โžก๏ธ Horizontal List: Horizontal drag & drop
  • ๐ŸŒณ Nested Tree Sort: Tree structure sorting
  • ๐Ÿ—ƒ๏ธ Copy to Zone: Copy items to another zone
  • ๐Ÿงฒ Snap to Grid
  • ๐Ÿ›ก๏ธ Boundary: Set boundaries for drag/resize
  • ๐Ÿ–ผ๏ธ Custom Placeholder
  • โšก Performance Optimized and Ultra lightweight
  • ๐Ÿง‘โ€๐Ÿ’ป Fully modular, Angular 18+ ready
  • ๐Ÿงฉ Modular: Drag & Drop, Grid, Sortable, Resizable

๐Ÿ”ง Installation

npm install ngx-drag-drop-kit

Or:

yarn add ngx-drag-drop-kit

โšก Quick Start

import { NgxDragDropKitModule } from 'ngx-drag-drop-kit';

@NgModule({
  imports: [NgxDragDropKitModule]
})
export class AppModule {}

๐Ÿ“š Usage Highlights

โœ… Basic Drag & Drop

<div ngxDropList [data]="list" (drop)="drop($event)">
  <div ngxDraggable *ngFor="let item of list">{{ item }}</div>
</div>
import { IDropEvent, moveItemInArray, transferArrayItem } from 'ngx-drag-drop-kit';

drop(event: IDropEvent) {
  if (event.previousContainer === event.container) {
    moveItemInArray(event.container.data, event.previousIndex, event.currentIndex);
  } else {
    transferArrayItem(event.previousContainer.data, event.container.data, event.previousIndex, event.currentIndex);
  }
}

๐Ÿงฉ Grid Layout

import { NgxGridLayoutModule } from 'ngx-drag-drop-kit';

@NgModule({
  imports: [NgxGridLayoutModule]
})
export class AppModule {}
<grid-layout [options]="options">
  <grid-item *ngFor="let item of layouts" [config]="item.config">
    {{ item.title }}
  </grid-item>
</grid-layout>
import { IGridLayoutOptions, GridItemConfig } from 'ngx-drag-drop-kit';

options: IGridLayoutOptions = { cols: 12, gap: 10 };
layouts = [
  { config: new GridItemConfig(0, 0, 2, 2), title: 'Item 1' },
  ...
];

๐Ÿ“ Resizable

<div ngxResizable [minWidth]="50" [minHeight]="50" (resize)="onResize($event)">
  Resizable!
</div>

๐ŸŒณ Nested Drag & Drop Tree

Supports multi-level tree-like structures with drag & drop:

<ng-template #tree let-items>
  <div ngxDropList [data]="items" (drop)="drop($event)">
    <div *ngxPlaceholder class="custom-placeholder"></div>
    <div ngxDraggable *ngFor="let item of items">
      {{ item.name }}
      <ng-container *ngIf="item.children">
        <ng-container
          [ngTemplateOutlet]="tree"
          [ngTemplateOutletContext]="{ $implicit: item.children }">
        </ng-container>
      </ng-container>
    </div>
  </div>
</ng-template>

๐Ÿ“„ API Summary

Directive/Component Input/Output Description
ngxDraggable Input Makes element draggable
dragStart, dragEnd Drag events
ngxDropList Input: [data] Drop zone array
Output: (drop) Drop event
ngxResizable [minWidth], [minHeight] Resizing constraints
Output: (resize) Emits size changes
GridLayoutComponent options Grid options
GridItemComponent config Grid item configuration

๐Ÿ“ฆ Demos & Examples

See working examples in the projects/demo folder.


๐Ÿ’– Support / Sponsor

Maintaining open-source libraries takes time and energy. If you find this project useful, please consider supporting me:

โ˜• One-time Donation

BuyMeACoffee

๐Ÿงก Monthly Sponsorship

GitHub Sponsors

๐Ÿ’ธ Crypto Support

You can also support via Tether (USDT) or Bitcoin (BTC):

  • BTC: bc1qnhnpn9dtk3det08hkpduv8x9u8rnesujplg0p2
  • Ethereum: 0x3891395BB3f6c4642f6C7001FDD9113F22065680
  • TRON: TRJ7a8npXFzkfDLfwsRz2CCH1GWHuuthaJ
  • TON: UQAejnuN0MUM8zxsbUsLYtCB79gl88NDSGbv6OYzly4h4yfT

Message me or create an issue if you want to be listed as a sponsor.


๐Ÿค Contributing

Pull requests welcome ๐Ÿ™Œ

git clone https://github.com/mr-samani/ngx-drag-drop-kit.git
cd ngx-drag-drop-kit
npm install
npm run start

๐Ÿ“œ License

MIT โ€” feel free to use & modify.


Built with โค๏ธ in Iran โ€“ by @mr-samani