State colour for oh-label-item in oh-list-card

Hi All

Is it possible to set the STATE colour of an ITEM within an oh-label-item?

I have managed to get the text color to chnage depending on the state, but this does not seem to affect the actual STATE:

Armed Status Color

component: oh-label-item
config:
  item: Partition3_Armed
  title: Partition 3 Armed
  action: navigate
  actionModal: page:Partition3Actions
  actionPage: page:Partition3Actions
  style:
    color: '=(items.Partition3_Armed.state == "ON") ? "red" : "black"'

Thank you.
Mark

You can easily simulate an oh-label-item by just using the more generic oh-list-item and putting a label in the after slot which will give you full control over that text.

component: oh-list-card
config:
  title: Label Demo
slots:
  default:
    - component: oh-label-item
      config:
        item: Switch_MasterBedroomFanLight_OnOff
        title: Light status
        style:
          color: red
    - component: oh-list-item
      config:
        title: Light status
        style:
          color: red
      slots:
        after:
          - component: Label
            config:
              text: =items.Switch_MasterBedroomFanLight_OnOff.state
              style:
                color: red

1 Like

Thank you Justin. Exactly what I was looking for:
Armed Status Color1

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.