# Groups and Tree view

Use **Canvas** or **Tree** in the main navbar.
The tree displays the same nodes, selection, and health signals as the
canvas. Expand/collapse groups, drag a row into a group, or select a row and
use the inspector's Parent field and Save details. Choose **Root**, or drop onto
empty tree space, to ungroup an item.
Double-click or double-tap an item to open it in the inspector. Viewers can navigate and inspect but cannot
edit membership. On mobile the tree uses compact nesting and a parent selector
so editing does not depend on drag-and-drop.

The node palette remains available in Tree view. Click a palette
type to create inside the
selected group, beside a selected leaf, or at the root when nothing is selected.
Drag a palette type onto a group to add directly there; dropping on a leaf adds
beside it. The new item opens in the inspector. On mobile, the palette starts
collapsed and opens as a sidebar overlay from its navbar button.

Membership is persisted as `parentId` on each node and exposed by `/api/graph`.

Tree, canvas group indicators, and the inspector roll up group health recursively:
failure takes precedence over warning, success, and unconfigured checks, in that
order. Empty/unconfigured groups remain unknown. These indicators are derived
from direct signals, so recovery, deletion, and reparenting immediately recalculate
the result without persisting synthetic checks.

## Membership in YAML

```yaml
nodes:
  machine:
    kind: host
    title: Development machine
    x: 0
    y: 0
    w: 600
    h: 400
  service:
    kind: app
    title: Local service
    parentId: machine
    x: 40
    y: 80
    w: 300
    h: 170
```

Coordinates remain absolute. Missing/null `parentId` means a root item.
Parents must be group-kind nodes; the editor rejects cyclic relationships.

## Canvas placement

- Creating or dropping a canvas node fully inside a group assigns membership.
  The smallest enclosing group wins; its top 32 pixels are reserved for its header.
- Creating a group around existing sibling nodes adopts those nodes.
- Moving a group carries all descendants, including nested groups.
- Hierarchy reparenting places the subtree below its new siblings, expanding
  the parent and ancestors as needed. Ungrouping places it to the right of the map.
- Canvas drops update membership at the end of the gesture, with the move and
  membership change sharing one undo checkpoint.
- Resizing a border does not change membership. Existing files are not assigned
  parents just because nodes overlap visually; use a drop or the parent selector.

Hierarchy placement can expand a group into neighboring canvas objects. It is
not a global layout engine; those neighbors retain their positions.
