Skip to content

Implement "allowDropInside" on the data object #3

@bartaxyz

Description

@bartaxyz

Defines whether content can be dropped inside an item. Children are still allowed, it's just impossible to drop any more children inside.

import React, { useState } from "react";
import { ReactTreeList, ReactTreeListProps } from '@bartaxyz/react-tree-list';

const Component: React.FC = () => {
  const [data, setData] = useState<ReactTreeListProps["data"]>([
    {
      label: "none",

      // This parameter will keep current children but prevent other items to be dropped inside
      allowDropInside: true,

      // Nodes inside "children" will be displayed and it will be possible to sort them, or drag them out
      children: [
        { label: "Heyo", },
      ],
    },
  ]);

  return (
    <ReactTreeList
      data={data}
      onChange={setData}
    />
  );
};

Default: true

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions