Switch Text - duplicate Labels

I want to put the same label on each of the buttons of a switch but can't seem to work out how to do it.

I want to change this:

{
  "1": 1,
  "2": 2,
  "3": 3,
  "4": 4,
  "5": 5,
  "Clear": 6
 }

To this:

{
  "+": 1,
  "+": 2,
  "+": 3,
  "+": 4,
  "+": 5,
  "Clear": 6
   }

Any ideas??

That's not possible, you'll have to build a switch with multiple buttons widget to do that.

Ok, thanks - that's what I was trying to avoid but never mind

I've just found a workaround....

{
  "+ ": 1,
  "+  ": 2,
  "+   ": 3,
  "+    ": 4,
  "+     ": 5,
  "Clear": 6
}

I forgot that was possible !

Ah but now this leads to the next question, how do I align the label so it always shows the + symbol on the button…

Not the most conventional solution but this should work:

Swayrian

Brilliant thanks

Wonder if things have moved on and you can have duplicate labels on a switch now?? I've got a 255 cell switch and I don't fancy using multiple buttons to build it!

Yes, another syntax allows that, now:

{
  labels: ['a','b', 'a', 'c'],
  values: [1, 2, 3, 4]
}

Brilliant - can you also add different styles or colours to the the various elements/buttons on the switch?

1 Like