How to add a label under an icon


#1

I followed this example to create a node template with icons, https://gojs.net/latest/samples/icons.html

      $(
        go.Shape,
        'Rectangle',
        { strokeWidth: 0 },
        new go.Binding('fill', 'isSelected', (selected, obj) => {
          return selected ? '#edffff' : 'white';
        }).ofObject(),
      ),
      $(go.Shape,
        { margin: 3, fill: '#cbc9c9', strokeWidth: 0 },
        new go.Binding('geometry', 'type', getIcon),
      ),
      $(go.TextBlock,
        {
          textAlign: 'center',
          font: '9pt helvetica, arial, sans-serif',
          margin: 4,
        },
        new go.Binding('name'),
      ),

However, the textBlock is not showing up, how would I modify my nodeTemplate such that I can show a label/ textBlock underneath the geometry/Icon.

Thanks


#2

You can use a vertical panel. Read more about composing nodes here.