Usage guidesElementsCombos

Combo overview

Learn what combos do and how to define and configure them

What is a combo

A combo groups related nodes, such as Web and Mobile in a Client group. A combo can also contain other combos. Its expanded outline follows the positions and sizes of its members. When collapsed, it hides member nodes and can appear as a circle or rectangle.

Data structure

Define combos in data.combos. A node’s comboId identifies its combo, and a child combo’s parentId identifies its parent combo. Edge endpoints still use node IDs.

FieldTypeRequiredDescription
idstringYesUnique combo ID
parentIdstringNoParent combo ID
collapsedbooleanNoWhether the combo starts collapsed
statesElementState[]NoInitial states, such as ['selected']
stylePartial<ComboStyleConfig>NoStyle for this combo
dataRecord<string, unknown>NoApplication data, such as a group name

Configuration

Set the default style in combo.style. To override a field for one combo, set it in that combo’s style. Supply node coordinates or let a layout calculate them.

Below, Web and Mobile belong to Client, which is nested in Platform. Archive starts collapsed.

Loading example…
The purple outline marks Client as selected. Archive starts collapsed.
data: {
  nodes: [
    { id: 'web', x: 100, y: 120, comboId: 'client' },
    { id: 'mobile', x: 220, y: 120, comboId: 'client' },
    { id: 'old-a', x: 420, y: 100, comboId: 'archive' },
    { id: 'old-b', x: 500, y: 140, comboId: 'archive' },
    { id: 'outside', x: 300, y: 260 },
  ],
  edges: [
    { id: 'live', source: 'mobile', target: 'outside' },
    { id: 'archived', source: 'old-a', target: 'outside' },
  ],
  combos: [
    { id: 'platform', data: { name: 'Platform' }, style: { padding: 24 } },
    { id: 'client', parentId: 'platform', data: { name: 'Client (selected)' }, states: ['selected'] },
    { id: 'archive', collapsed: true, data: { name: 'Archive (collapsed)' } },
  ],
},

See Common combo options for styling, collapsing, and dragging.