Skip to content

[docs] Add recipe for constraining the make-child drop action by item type#22940

Open
michelengelen wants to merge 1 commit into
mui:masterfrom
michelengelen:recipe/treeview/18555
Open

[docs] Add recipe for constraining the make-child drop action by item type#22940
michelengelen wants to merge 1 commit into
mui:masterfrom
michelengelen:recipe/treeview/18555

Conversation

@michelengelen

Copy link
Copy Markdown
Member

Addresses #18555, which asked how to use the drag action (make-child vs. reorder) inside canMoveItemToNewPosition to restrict nesting. Since that callback doesn't receive the action directly, the demo shows deriving the equivalent result from newPosition.parentId, looked up via apiRef.current.getItem(), to restrict drops to folder-type items only. Updates the Ordering docs with this technique.

Fixes #18555

@michelengelen michelengelen self-assigned this Jun 25, 2026
@michelengelen michelengelen added docs Improvements or additions to the documentation. type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature. scope: tree view Changes related to the tree view. This includes TreeView, TreeItem. recipe labels Jun 25, 2026
@code-infra-dashboard

Copy link
Copy Markdown

Deploy preview

Bundle size

Bundle Parsed size Gzip size
@mui/x-data-grid 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-pro 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-premium 0B(0.00%) 0B(0.00%)
@mui/x-charts 0B(0.00%) 0B(0.00%)
@mui/x-charts-pro 0B(0.00%) 0B(0.00%)
@mui/x-charts-premium 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers-pro 0B(0.00%) 0B(0.00%)
@mui/x-tree-view 0B(0.00%) 0B(0.00%)
@mui/x-tree-view-pro 0B(0.00%) 0B(0.00%)
@mui/x-license 0B(0.00%) 0B(0.00%)

Details of bundle changes


Check out the code infra dashboard for more information about this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to the documentation. recipe scope: tree view Changes related to the tree view. This includes TreeView, TreeItem. type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[tree view] Allow to customize the drop position for the "make-child" action

1 participant