Cluster control
When do you use it?
Add a control to activate clustering for a given field or set of selectors via a list of labels, buttons or a dropdown menu.
Basic Editor
To create a cluster control, follow these steps:
- Click the settings icon on the right - to open the editor, then click "Add custom control". 
- In the menu that opens up, click on the first dropdown and change the value to "Cluster elements". 
- Use the other dropdowns to customize the look and location of your controls. 
- Click Save at the bottom to save your changes. 
- To add multiple controls, repeat steps 1-4 for each control. 
Advanced Editor
Cluster by field:
@controls {
  bottom {
    cluster {
      by: "Project";
    }
  }
}
Cluster using custom selectors:
@controls {
  top {
    cluster {
      as: buttons;
      option {
        value: person by "Project";
        label: "Project";
      }
      option {
        value: person by "Country";
        label: "Country";
      }
      option {
        value: person by "Organization";
        label: "Organization";
      }
    }
  }
}
Supported properties
- byis the field you'd like to use for clustering wrapped in double quotes. If you don't include- by: fieldyou need to list out each option - see "supported children" guidance below.
- ascontrols how the control is presented. Do you want a list of labels, buttons, or a dropdown for activating clustering?- labelsshow options as a list of clickable labels
- buttonsshow options as a group of buttons
- dropdownshow options as dropdown
 
- multiplecontrols whether more than one value can be selected at a time- trueallow multiple values to be selected
- falseonly allow one value to be selected at a time
 
- placeholderthe text to display when nothing is selected (for- as: dropdownonly)
- summaryoverride the summary that's shown for the current selection (for- as: dropdown). The summary will be shown regardless of what's selected so there's no need to use- placeholderin this case.
- defaultdefines which field values should be selected by default (for- by: "field"only). Use- select-allto select everything by default.
Check out our controls reference to see the full list of properties and values recognized by the cluster control.
Supported children
If you want to use custom selectors to build clustering options, you'll need to list each option out separately. The options are defined by option blocks nested within the control and each option supports the following properties:
- labelthe text to display for that option
- valueadvanced cluster rule to cluster by
- default- truevalue is selected by default
- falsevalue is unselected by default
 
Last updated
Was this helpful?
