Can someone help me get this if-then statement to work for the HA dashboard?

type: button
entity: input_select.variable_huglo_stue_lille_venstre
name: Stue Lille Venstre
icon: mdi:blinds
show_state: true
tap_action:
  action: call-service
  service: input_select.select_option
  service_data:
    entity_id: input_select.variable_huglo_stue_lille_venstre
    option: |
      [[[ if (entity.state === 'up') return 'down';
          else if (entity.state === 'down') return 'up';
          else return 'up'; ]]]

Create a script that toggles the Input Select’s state. Set the Button card’s tap_action to call the script.

There’s an example in the documentation showing how tap_action is used to call a script.