Mushroom Chips Template with multiline content

Dear comunity,
I found something interesting (at least for me) and I want to share in order to save time to somebody.
Thanks to the masive badges incompatibility introduced in 2024.8, (argh: 2024.8: Beautiful badges!), I was forced to rewrite one dashboard. I decided to use mushroom-chips card. Its template kind was almost ideal for my purpose except the content which is allways showed in one line. Googling and experimentig I found the way to display multi line text in template chip.
There is the code:

type: custom:mushroom-chips-card
chips:
  - type: template
    entity: switch.grijanje_termostat
    use_entity_picture: true
    content: |
      Grijanje
      {{ state_attr("sensor.grijanje_termostat_state", "desc_hr") }}
    picture: '{{ state_attr("sensor.grijanje_termostat_state","picture") }}'
    tap_action:
      action: more-info
    card_mod:
      style: |
        ::slotted(span) {
          content: "\a";
          white-space: pre;
        }
        ha-card 
          {
            --chip-background: {%- if is_state('var.plamenik_greska', 'on') -%}#ffd0d0{%- else -%}{%- if is_state('binary_sensor.thermostat_on', 'on') -%}#ffe4b3{%- else -%}#d0ffd0{%- endif -%}{%- endif -%};
            --chip-border-color: {%- if is_state('var.plamenik_greska', 'on') -%}red{%- else -%}{%- if is_state('binary_sensor.thermostat_on', 'on') -%}orange{%- else -%}green{%- endif -%}{%- endif -%};
            --card-mod-icon-color: {%- if is_state('var.plamenik_greska', 'on') -%}red{%- else -%}{%- if is_state('binary_sensor.thermostat_on', 'on') -%}orange{%- else -%}green{%- endif -%}{%- endif -%};
          }

This produces:
multiline_template_chip

1 Like

you might wish to check out THIS thread then

Excuse me, but how is this related?
There is nothing about mushroom-chips.
Don’t get me wrong, but your comment is nothing than noise in channel.