When a node is collapsed the expand/collapse button itself shows the total number of hidden descendants: it widens into a pill and swaps its + glyph for the count. The button returns to a plain − circle when the node is expanded again.
Bob and Jane are pre-collapsed — click their buttons to toggle.
Custom green count pill. Click to expand/collapse.
Count only shown when ≥ 3 nodes hidden. Bob (5) shows; Jane keeps a plain +.
Plain + glyph even when collapsed, no count.
Red count pill via --apex-tree-badge-bg and --apex-tree-badge-color.
The count rides in the button, which sits on the node's right edge.