You can collapse and expand (or fold) container shapes, available in the Advanced shape library. This behaviour is enabled by default, but may be disabled via the diagrams.net menu.
- Select Extras > Collapse/Expand in the menu. The checkmark next to this menu item indicates whether it is enabled (check) or disabled (blank).
Minimal theme: Right click, then select Options > Collapse/Expand.
To turn any shape into a container, select it, then press Ctrl+G on Windows, or Cmd+G on macOS.