# Documentation v8.0.38

Preview Downloads Purchase
Draggable is a lightweight, responsive, modern drag & drop library. Draggable abstracts native browser events into a comprehensive API to create a custom drag and drop experience. For more info see the official siteand the Github repository.

# Restricted Zones Example

- Wrap draggable zone with `.draggable-zone`and define draggable elements with `.draggable`and let drag & drop through `.draggable-handle`element.
- Add `data-kt-draggable-level="restricted"`to draggable zones to set a restricted permission level to the container.
- Define draggable cards with permissions levels by adding `data-kt-draggable-level="admin"`to allow specific cards into the restricted container.
- Restricted cards are allowed to drag into any column.
- Restricted column will only allow restricted cards

The HTML attribute is not an official attribute, and can be replaced with any other name according to your product requirements.

### Public Tasks

### Card 1

Lorem Ipsum is simply dummy text of the printing and typesetting industry.

### Card 2

Lorem Ipsum is simply dummy text of the printing and typesetting industry.

### Card 3

Lorem Ipsum is simply dummy text of the printing and typesetting industry.

### Public Tasks

### Card 4

Lorem Ipsum is simply dummy text of the printing and typesetting industry.

### Card 5

Lorem Ipsum is simply dummy text of the printing and typesetting industry.

### Card 6

Lorem Ipsum is simply dummy text of the printing and typesetting industry.

### Restricted

### Card 7

Lorem Ipsum is simply dummy text of the printing and typesetting industry.

### Card 6

Lorem Ipsum is simply dummy text of the printing and typesetting industry.

    var containers = document.querySelectorAll(".draggable-zone");
    const restrcitedWrapper = document.querySelector("[data-kt-draggable-level="restricted"]");

    if (containers.length === 0) {
        return false;
    }

    var droppable = new Droppable.default(containers, {
        draggable: ".draggable",
        dropzone: ".draggable-zone",
        handle: ".draggable .draggable-handle",
        mirror: {
            //appendTo: selector,
            appendTo: "body",
            constrainDimensions: true
        }
    });

    // Define draggable element variable for permissions level
    let droppableOrigin;

    // Handle drag start event -- more info: https://shopify.github.io/draggable/docs/class/src/Draggable/DragEvent/DragEvent.js~DragEvent.html
    droppable.on("drag:start", (e) => {
        droppableOrigin = e.originalSource.getAttribute("data-kt-draggable-level");
    });

    // Handle drag over event -- more info: https://shopify.github.io/draggable/docs/class/src/Draggable/DragEvent/DragEvent.js~DragOverEvent.html
    droppable.on("drag:over", (e) => {
        const isRestricted = e.overContainer.closest("[data-kt-draggable-level="restricted"]");
        if (isRestricted) {
            if (droppableOrigin !== "admin") {
                restrcitedWrapper.classList.add("bg-light-danger");
            } else {
                restrcitedWrapper.classList.remove("bg-light-danger");
            }
        } else {
            restrcitedWrapper.classList.remove("bg-light-danger");
        }
    });

    // Handle drag stop event -- more info: https://shopify.github.io/draggable/docs/class/src/Draggable/DragEvent/DragEvent.js~DragStopEvent.html
    droppable.on("drag:stop", (e) => {
        // remove all draggable occupied limit
        containers.forEach(c => {
            c.classList.remove("draggable-dropzone--occupied");
        });

        // Remove restricted alert
        restrcitedWrapper.classList.remove("bg-light-danger");
    });

    // Handle drop event -- https://shopify.github.io/draggable/docs/class/src/Droppable/DroppableEvent/DroppableEvent.js~DroppableDroppedEvent.html
    droppable.on("droppable:dropped", (e) => {
        const isRestricted = e.dropzone.closest("[data-kt-draggable-level="restricted"]");
        // Detect if drop container is restricted
        if (isRestricted) {
            // Check if dragged element has permission level
            if (droppableOrigin !== "admin") {
                restrcitedWrapper.classList.add("bg-light-danger");
                e.cancel();
            }
        }
    });

    <div class="row row-cols-lg-3 g-10">
        <!--begin::Col-->
        <div class="col">
            <!--begin::Card-->
            <div class="card card-bordered mb-10">
                <!--begin::Card header-->
                <div class="card-header">
                    <div class="card-title">
                        <h3 class="card-label">Public Tasks</h3>
                    </div>
                </div>
                <!--end::Card header-->

                <!--begin::Card body-->
                <div class="card-body">
                    <!--begin::Row-->
                    <div class="row row-cols-1 g-10 min-h-200px draggable-zone">
                        <!--begin::Col-->
                        <div class="col draggable">
                            <!--begin::Card-->
                            <div class="card bg-light-primary">
                                ...
                            </div>
                            <!--end::Card-->
                        </div>
                        <!--begin::Col-->

                        <!--end::Col-->
                        <div class="col draggable">
                            <!--begin::Card-->
                            <div class="card bg-light-primary">
                                ...
                            </div>
                            <!--end::Card-->
                        </div>
                        <!--begin::Col-->

                        <!--end::Col-->
                        <div class="col draggable">
                            <!--begin::Card-->
                            <div class="card bg-light-primary">
                                ...
                            </div>
                            <!--end::Card-->
                        </div>
                        <!--end::Col-->
                    </div>
                    <!--end::Row-->
                </div>
                <!--end::Card body-->
            </div>
            <!--end::Card-->
        </div>
        <!--end::Col-->

        <!--begin::Col-->
        <div class="col">
            <!--begin::Card-->
            <div class="card card-bordered">
                <!--begin::Card header-->
                <div class="card-header">
                    <div class="card-title">
                        <h3 class="card-label">Public Tasks</h3>
                    </div>
                </div>
                <!--end::Card header-->

                <!--begin::Card body-->
                <div class="card-body">
                    <!--begin::Row-->
                    <div class="row row-cols-1 g-10 min-h-200px draggable-zone">
                        <!--begin::Col-->
                        <div class="col draggable">
                            <!--begin::Card-->
                            <div class="card bg-light-success">
                                ...
                            </div>
                            <!--end::Card-->
                        </div>
                        <!--end::Col-->

                        <!--begin::Col-->
                        <div class="col draggable">
                            <!--begin::Card-->
                            <div class="card bg-light-success">
                               ...
                            </div>
                            <!--end::Card-->
                        </div>
                        <!--end::Col-->

                        <!--begin::Col-->
                        <div class="col draggable">
                            <!--begin::Card-->
                            <div class="card bg-light-success">
                                ...
                            </div>
                            <!--end::Card-->
                        </div>
                        <!--end::Col-->
                    </div>
                    <!--end::Row-->
                </div>
                <!--end::Card body-->
            </div>
            <!--end::Card-->
        </div>
        <!--end::Col-->

        <!--begin::Col-->
        <div class="col">
            <!--begin::Card-->
            <div class="card card-bordered" data-kt-draggable-level="restricted">
                <!--begin::Card header-->
                <div class="card-header">
                    <div class="card-title">
                        <h3 class="card-label">Restricted</h3>
                    </div>
                </div>
                <!--end::Card header-->

                <!--begin::Card body-->
                <div class="card-body">
                    <!--begin::Row-->
                    <div class="row row-cols-1 g-10 min-h-200px draggable-zone">
                        <!--begin::Col-->
                        <div class="col draggable" data-kt-draggable-level="admin">
                            <!--begin::Card-->
                            <div class="card bg-light-danger">
                                ...
                            </div>
                            <!--end::Card-->
                        </div>
                        <!--end::Col-->

                        <!--begin::Col-->
                        <div class="col draggable" data-kt-draggable-level="admin">
                            <!--begin::Card-->
                            <div class="card bg-light-danger">
                                ...
                            </div>
                            <!--end::Card-->
                        </div>
                        <!--end::Col-->
                    </div>
                    <!--end::Row-->
                </div>
                <!--end::Card body-->
            </div>
            <!--end::Card-->
        </div>
        <!--end::Col-->
    </div>

### Explore

### Metronic Licenses

License FAQs
Regular License
For single end product used by you or one client
$ 39
Extended License
For single SaaS app with paying users
$ 969
Custom License
Reach us for custom license offers.
Contact Us
Buy Now

### Metronic Demos

Demo 1
Demo 2
Demo 3
Demo 4
Demo 5
Demo 6
Demo 7
Demo 8
Demo 9
Demo 10
Demo 11
Demo 12
Demo 13
Demo 14
Demo 15
Demo 16
Demo 17
Demo 18
Demo 19
Demo 20
Demo 21
Demo 22
Coming soon
Coming soon

##### Learn & Get Inspired

## Support at devs.keenthemes.com

Join our developers community to find answer to your question and help others. FAQs
Get Support
Documentation & Videos
From guides and video tutorials, to live demos and code examples to get started.
Plugins & Components
Check out our 300+ in-house components and customized 3rd-party plugins.
Layout Builder
Build your layout, preview it and export the HTML for server side integration.
Metronic Downloads
Download your prefered framework and demo with one click.
What's New
Latest features and improvements added with our users feedback in mind.
Buy now