Skip to content

Group

A group is a way to collect similar tokens. Any nested object in your schema that is not a token counts as a group. Groups can be nested infinitely, and even set default $types that apply to all children.

json
{
  "color": {
    "$description": "color palette",
    "red": {
      "$type": "color",
      "$value": "#fa4549"
    }
  },
  "typography": {
    "$description": "Typographic styles",
    "family": {
      "GraphikRegular": {
        "$type": "fontFamily",
        "$value": "Graphik Regular"
      }
    }
  }
}
yaml
color:
  $description: color palette
  red:
    $type: color
    $value: "#fa4549"
typography:
  $description: Typographic styles
  family:
    GraphikRegular:
      $type: fontFamily
      $value: Graphik Regular
PropertyTypeDescription
$typestring(Optional) Set a default $type that applies to all children (unless one is specified on a token)
$descriptionstring(Optional) A description of this group.
$extensionsobject(Optional) Any arbitrary data is allowed within $extensions object.
$extensions.requiredModesstring[](Optional) Cobalt: Enforce mode IDs that must be present on all child tokens.

Notes

  • Groups can’t be aliased; only token $values can accept aliases.
  • A token can’t contain a group. Many design systems want to have a “default” token for each group, and the only way to do this is to reserve a special name in your schema for this purpose (such as default).