MainUI - Widget Component Dynamic Visibility

hi,

i have the following code written in MainUI Widget. Note the Visibility which depends on another item state to show or hide. However, this does not seem to work dynamically. Any idea why? My intention is to dynamically show/hide a button subject to another item’s state. Thank you

     - component: f7-row
            config:
                 visible: =(items[props.op_manual].state == 'ON')
             slots:
              default:
                - component: Label
                  config:
                    style:

Your visible expression is correct and should work dynamically. If it does not, then there is something else going on. Possibilities include: 1) you’re not setting the os_manual parameter correctly, 2) that item does not have the ON or OFF states that you are expecting, 3) there is something else going on in the rest of the widget that you haven’t posted (e.g., you don’t have any actual text in the label and so there is nothing to show when the visible property changes).

you are right, the following code doesn’t seem to trigger send command/update to update the item state (it is not associated to any thing)

             - component: oh-toggle
                  config:
                    item: =items[props.op_manual]
                    style:
                      position: absolute
                      right: 5px
                      top: 2px

The item property should be an item name. items[props.op_manual] is returning the item state object of the item named by the props.os_manual parameter, so there is no sensible way for the toggle to know which item you want to control. You want to just use that item name:

item: =props.op_manual

instead.

An item does not need to be link to any channel to be receive commands. Unlinked items are used frequently as system variables and cen be used just fine in widgets.