button-card icon indicating copy to clipboard operation
button-card copied to clipboard

Styles options for units attribute

Open maxalbani opened this issue 5 years ago • 6 comments

Describe the solution you'd like It would be useful to have the styles options available for the units attribute.

styles:
  name:
    - xxx
    - xxx
  units:
    - xxx
    - xxx

Thanks! Max

maxalbani avatar Jun 01 '21 13:06 maxalbani

any news? it is the only attribute that cannot be customized!

Thanks

maxalbani avatar Oct 05 '21 15:10 maxalbani

You can - but not in a direct way: https://community.home-assistant.io/t/lovelace-button-card/65981/5897

Would be cool to be able to manage it as you suggested!

pedolsky avatar Oct 05 '21 16:10 pedolsky

You can - but not in a direct way: https://community.home-assistant.io/t/lovelace-button-card/65981/5897

Would be cool to be able to manage it as you suggested!

yes i know, i do it with state_display but in certain situations it would be much more comfortable with styles. The url doesn't work

maxalbani avatar Oct 05 '21 18:10 maxalbani

Strange that the link isn’t working. Anyway, here’s the code:

state_display: |
  [[[ return Math.round(entity.state | 0) + `<span style='font-size: 14px;
  vertical-align: 32px'>°C</span>` ]]]

pedolsky avatar Oct 06 '21 09:10 pedolsky

@pedolsky exactly as I use it too, but it is a workaround that creates problems in particular cases. I really hope my request will be considered

maxalbani avatar Oct 06 '21 09:10 maxalbani

Units is part of state. The option you have is to style state.

dcapslock avatar Aug 29 '25 12:08 dcapslock