I’m trying to create a custom:buttoncard with custom fields and an if statement.
In de basic it is working fine.
Except that the text after the if statement is not using the style.
It is placing the text at right of the button except at the left
I now using a lot of minus signs to compensate that
The span after the else does working using the style
I tried to at style within the span brackets. All without succes.
What am I doing wrong?
The part of the custom fields out of the card code:
custom_fields:
tekst:
- white-space: normal
- word-wrap: break-word
- align-self: flex-start
- justify-self: flex-start
- text-align: left
- margin-left: 10px
- margin-right: 6px
- margin-top: 0px
- margin-bottom: 12px
- font-size: 12px
- left: 3%
custom_fields:
tekst: |
[[[
if (states["sensor.berichten"].attributes.bericht == "")
return ` <span>
------------------------------------------ Geen berichten -------------------------------------------
</span>`
else
return `
<span> ${states['sensor.berichten'].attributes.bericht.replace(/\n/g, "<br>")} <br><br> ------------------------------------------------------------<br>- Klik om de berichten te verwijderen -</span>`
]]]