Foblex Flow
Introduction
Overview
Nodes
Custom Nodes
Drag Handle
Node Selection
Resize Handle
Rotate Handle
Grouping
Updated
Drag to Group
Updated
Stress Test
Stress Test with Connections
Connectors
Node as Connector
Connector Inside Node
Connector Outlet
Limiting Connections
Connectability Check
Connectable Side
Connections
Drag to Connect
Drag to Reassign
Updated
Create Node on Connection Drop
Remove Connection on Drop
Assign Node to Connection on Drop
Auto Snap
Connection Types
Custom Connection Type
Connection Behaviours
Connection Markers
Connection Text
Connection Center
Custom Connections
Extensions
Add Node from Palette
Selection Area
Help in Positioning
Grid System
Minimap
Zoom
Background
Advanced
Cut/Copy/Paste
New
Undo/Redo
Undo/Redo V2
New
Dagre Layout
ELKJS Layout
Drag Start/End Events
Custom Event Triggers
Pro Examples
Visual Programming
DB Management
UML Diagram
Tournament Bracket
Foblex Flow

Drag to Group

Description

Drag nodes into groups in Foblex Flow, create nested hierarchies, and build dynamic structures with auto-sizing, padding, and drop events in Angular.

Overview

This example shows how elements (nodes or groups) can be grouped simply by dragging them into containers. It demonstrates a flexible approach to building hierarchical structures in Foblex Flow, where groups can contain groups, and nodes can be nested inside groups or even other nodes.

The only restriction is that groups cannot be placed inside nodes, ensuring a consistent parent–child model.

You can also create new nodes directly inside a container by dragging them from an external palette using the fExternalItem directive.

The example introduces key behaviors such as respecting padding boundaries (fIncludePadding), automatically resizing groups to fit their children (fAutoSizeToFitChildren), and expanding groups on collision with children (fAutoExpandOnChildHit).

Key features in this demo

  • Drag-to-group interaction Move nodes or groups into another group by dragging. Parent/child relations update automatically.
  • Nested structures Groups can be nested inside other groups, and nodes can be nested without limit (node → node → node).
  • External palette integration Dragging from an external panel (fExternalItem) creates a new node directly inside a group or node.
  • Geometry options
  • fIncludePadding: children cannot overlap the parent’s padding area.
  • fAutoSizeToFitChildren: parent resizes to wrap its children.
  • fAutoExpandOnChildHit: parent expands dynamically when children collide with its borders.
  • Dynamic creation & grouping

Events:

  • fDropToGroup: emitted when an element is dropped into a group.
  • fCreateNode: emitted when a new node is created via drag from the palette.

Practical tips

  • Use fDropToGroup to implement custom logic when reorganizing hierarchy.
  • Combine external palettes with fCreateNode for drag-and-drop editors that let users spawn nodes inside any container.
  • Turn on Auto Expand for the best UX in editors where resizing groups manually would slow down the flow.
  • Nesting is unlimited, but avoid putting groups inside nodes (not supported).

Example

[component.html] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/projects/f-examples/nodes/drag-to-group/drag-to-group.component.html [component.ts] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/projects/f-examples/nodes/drag-to-group/drag-to-group.component.ts [component.scss] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/projects/f-examples/nodes/drag-to-group/drag-to-group.component.scss [common.scss] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/projects/f-examples/_flow-common.scss