# Network - groups

Handles the group styling.

Back to overview.

### Options

The options for the canvas have to be contained in an object titled 'groups'.

Click on the options shown to show how these options are supposed to be used.

    var options = {
      groups:{
        useDefaultGroups: true,
        myGroupId:{
          /*node options*/
        }
      }
    }

    network.setOptions(options);

All of the individual options are explained here:

Name | Type | Default | Description
--- | --- | --- | ---
useDefaultGroups | Boolean | `true` | If your nodes have groups defined that are not in the Groups module, the module loops over the groups it does have, allocating one for each unknown group. When all are used, it goes back to the first group. By setting this to false, the default groups will not be used in this cycle.
group* | Object | `` | You can add multiple groups containing styling information that applies to a certain subset of groups. All options described in the nodes module that make sense can be used here (you're not going to set the same id or x,y position for a group of nodes). Example:
    var nodes = [
        {id:1, group:'myGroup', label:"I'm in a custom group called 'myGroup'!"}
    ]

    var options = {
      groups: {
        myGroup: {color:{background:'red'}, borderWidth:3}
      }
    }
*) the option is not called group, as shown by the example but can by any custom id, except for 'useDefaultGroups'.