Mushroom Cards - Build a beautiful dashboard easily 🍄 (Part 1)

Something like this:

      - type: custom:mushroom-chips-card
        chips:
.
.
.
          - type: template
            icon: mdi:washing-machine
            icon_color: orange
            entity: switch.washing_machine
          - type: template
            icon: mdi:washing-machine
            icon_color: orange
        card_mod:
          style:
            mushroom-template-chip:nth-child(2)$: |
              ha-icon {
                {{ 'animation: shake 400ms ease-in-out infinite;' if is_state('sensor.washing_machine', 'on') }}
                transform-origin: 50% 58%;
                clip-path: polygon(0 0, 0 100%, 35% 100%, 34% 68%, 60% 41%, 71% 56%, 65% 74%, 47% 79%, 32% 69%, 35% 100%, 100% 100%, 100% 0);
              }
              @keyframes shake {
                0%, 100% { transform: translate(0, 0) rotate(0); }
                20%  { transform: translate(0.4px, -0.4px) rotate(-4deg); }
                40%  { transform: translate(-0.4px, 0.4px) rotate(4deg); }
                60%  { transform: translate(0.4px, 0.4px) rotate(-4deg); }
                80%  { transform: translate(-0.4px, -0.4px) rotate(4deg); }
              }
            mushroom-template-chip:nth-child(3)$: |
              mushroom-chip {
                cursor: default !important;
              }
              ha-icon {
                position: absolute;
                left: -35px;
                {{ 'animation: spin 1s linear infinite;' if is_state('sensor.washing_machine', 'on') }}
                transform-origin: 50% 58%;
                clip-path: circle(21.7% at 50% 58%);
              }
              @keyframes spin {
                100% { transform: rotate(360deg); }
              }
            .: |
              ha-card {
                --chip-box-shadow: none;
              }
        alignment: center

Can you try and explain a bit more what you are wanting here?

Need some help with a template card.

Have a template card, that shuts down and power on (wol) my unRAID server.
In general the card works.

image

When pushing the button, it takes around 30 seconds until its powered down and the state changes. Is it possible to have the secondary info showing in that time, that the server gets powered off until the state changes to powered off? And also, when its powered off the other way?

Actually my state change is:

{% if is_state(‘switch.unraid’, ‘on’) %}
Powered On
{% else %}
Powered Off
{% endif %}

Hope you can help. :slight_smile:

Hey. I`ve copied my question once again. Maybe someone will have solution for it?

Hoping someone can help with a browser_mod.popup issue, interestingly I’m sure the following code use to work but a recent release broke it.

When I add the following code directly on a dashboard its formatted as I want it:

type: vertical-stack
cards:
  - square: false
    columns: 2
    type: grid
    cards:
      - type: custom:vertical-stack-in-card
        style: |
          ha-card {
             margin: 20px 0px 0px 20px;
             padding-left: 20px;
             padding-right: 20px;
           }  
        cards:
          - type: custom:mushroom-template-card
            style: |
              ha-card {
                 background: transparent;
                 margin: 0px -10px 0px;
               }  
            primary: Open
            secondary: >-
              {% if is_state('switch.nodered_blinds_livingroom_morning', 'on')
              %}
               Enabled
              {% else %}
                Disabled
              {% endif %}
            icon: mdi:alarm
            entity: ''
            icon_color: >-
              {% if is_state('switch.nodered_blinds_livingroom_morning', 'on')
              %}
               blue
              {% else %}
                grey
              {% endif %}
            tap_action:
              action: call-service
              service: switch.toggle
              data: {}
              target:
                entity_id: switch.nodered_blinds_livingroom_morning
          - type: custom:layout-card
            layout_type: masonry
            layout:
              width: 221
              max_cols: 1
              height: auto
              padding: 0px
              card_margin: var(--masonry-view-card-margin, 0px 0px 0px)
          - type: custom:mushroom-chips-card
            chips:
              - type: template
                card_mod:
                  style: |
                    ha-card {
                      --chip-box-shadow: none;
                    }
                icon: mdi:minus
                tap_action:
                  action: call-service
                  service: script.automation_livingroom_blinds_morning_decrease
              - type: template
                card_mod:
                  style: |
                    ha-card {
                      --chip-background: transparent;
                      --chip-box-shadow: none;
                    }
                entity: input_datetime.automation_blind_evening_livingroom
                content: >-
                  {{(state_attr('input_datetime.automation_blind_morning_livingroom','timestamp'))
                  | timestamp_custom('%H:%M', false) }}
                tap_action:
                  action: more-info
              - type: template
                card_mod:
                  style: |
                    ha-card {
                      --chip-box-shadow: none;
                    }
                icon: mdi:plus
                tap_action:
                  action: call-service
                  service: script.automation_livingroom_blinds_morning_increase
            alignment: center
            card_mod:
              style: |
                ha-card {
                  margin: -2px 0px 12px;
                  --chip-border-width: 0;
                  --chip-border-radius: 12px;
                  --chip-height: 40px;
                  --chip-padding: 12px;
                  --chip-spacing: 1px;
                }
      - type: custom:vertical-stack-in-card
        style: |
          ha-card {
             margin: 20px 20px 0px 0px;
             padding-left: 20px;
             padding-right: 20px;
           }  
        cards:
          - type: custom:mushroom-template-card
            style: |
              ha-card {
                 background: transparent;
                 margin: 0px -10px 0px;
               }  
            primary: Close
            secondary: >-
              {% if is_state('switch.nodered_blinds_livingroom_evening', 'on')
              %}
               Enabled
              {% else %}
                Disabled
              {% endif %}
            icon: mdi:alarm
            entity: ''
            icon_color: >-
              {% if is_state('switch.nodered_blinds_livingroom_evening', 'on')
              %}
               blue
              {% else %}
                grey
              {% endif %}
            tap_action:
              action: call-service
              service: switch.toggle
              data: {}
              target:
                entity_id: switch.nodered_blinds_livingroom_evening
          - type: custom:layout-card
            layout_type: masonry
            layout:
              width: 221
              max_cols: 1
              height: auto
              padding: 0px
              card_margin: var(--masonry-view-card-margin, 0px 0px 0px)
          - type: custom:mushroom-chips-card
            chips:
              - type: template
                card_mod:
                  style: |
                    ha-card {
                      --chip-box-shadow: none;
                    }
                icon: mdi:minus
                tap_action:
                  action: call-service
                  service: script.automation_livingroom_blinds_evening_decrease
              - type: template
                card_mod:
                  style: |
                    ha-card {
                      --chip-background: transparent;
                      --chip-box-shadow: none;
                    }
                entity: input_datetime.automation_blind_evening_livingroom
                content: >-
                  {{(state_attr('input_datetime.automation_blind_evening_livingroom','timestamp'))
                  | timestamp_custom('%H:%M', false) }}
                tap_action:
                  action: more-info
              - type: template
                card_mod:
                  style: |
                    ha-card {
                      --chip-box-shadow: none;
                    }
                icon: mdi:plus
                tap_action:
                  action: call-service
                  service: script.automation_livingroom_blinds_evening_increase
            alignment: center
            card_mod:
              style: |
                ha-card {
                  margin: -2px 0px 12px;
                  --chip-border-width: 0;
                  --chip-border-radius: 12px;
                  --chip-height: 40px;
                  --chip-padding: 12px;
                  --chip-spacing: 1px;
                }

However, if I use the same code in a browser_mod.popup it comes out like this:

It seems to be the popup doesn’t like the first vertical-stack?

2 Likes

You can combine the Mushroom Light and Select cards like this.

Mushroom Light Preset Card:

type: custom:stack-in-card 
cards:
  - type: custom:mushroom-light-card
    entity: light.led_matrix
    show_brightness_control: true
    use_light_color: true
    show_color_control: true
    card_mod:
      style: |
        ha-card {
          --ha-card-border-width: 0;
        }
  - type: custom:mushroom-select-card
    entity: select.led_matrix_preset
    icon_type: none
    secondary_info: none
    primary_info: none
    card_mod:
      style: |
        ha-card {
          position: absolute;
          top: 0px;
          right: 0px;
          width: 50%;
          --ha-card-border-width: 0;
        }
card_mod:
  style: |
    :host {
      border-radius: var(--ha-card-border-radius, 12px);
      background: var(--card-background-color);
    }
    ha-card {
      overflow: visible !important;
      {% if is_state('light.led_matrix', 'on') %}
        background: {{ '#%02x%02x%02x13' % state_attr('light.led_matrix', 'rgb_color') }};
      {% endif %}
    }
15 Likes

It is mostly documented in the Mushroom Themes Github. Additional variables can be discovered by digging in to the code or CSS.

1 Like

I would like to have an animation like this when I press the button to open the gate

N.B. The switch is configured at 300ms but I would like the animation to last 2/3 seconds

This gif is the animation of the home assistant widget

Screen_Recording_20230220_121508_One-UI-Home_1

Any way to change the primary and secondary text color? I tried:

--primary-text-color: "FF0000"
--secondary-text-color: "00FF00"

But, that doesn’t have any effect:

Try:

--primary-text-color: #FF0000;
--secondary-text-color: #00FF00;

or something like this:

card_mod:
  style: |
    mushroom-card {
      --primary-text-color: red;
      --card-primary-font-size: 40px;
     }

I wonder if anyone can help me troubleshoot a difference between Firefox on Windows and iOS Companion app displaying the same card differently? On Firefox the card displays correctly but on iOS the circle that should surround the kitchen icon is squased. The same problem happens on iOS Safari…

Capture
ios

type: custom:vertical-stack-in-card
cards:
  - type: custom:mushroom-chips-card
    chips:
      - type: template
        icon: mdi:door
        icon_color: >-
          {% if is_state('binary_sensor.back_door_sensor_magnet_on_off','on') %}
            red
          {% elif is_state('binary_sensor.back_door_sensor_magnet_on_off','off')
          %}
            green
          {% else %}
            disabled
          {% endif %}
      - type: template
        icon: |-
          {% if is_state('binary_sensor.kitchen_motion_group','on') %}
            mdi:motion-sensor
          {% else %}
            mdi:walk
          {% endif %}
        icon_color: |-
          {% if is_state('binary_sensor.kitchen_motion_group','on') %}
            red
          {% elif is_state('binary_sensor.kitchen_motion_group','off') %}
            green
          {% else %}
            disabled
          {% endif%}
      - type: template
        icon: mdi:thermometer
        icon_color: orange
        use_entity_picture: false
        content: '{{ states("sensor.kitchen_sensor_temperature")  |round(1) }}C'
        entity: sensor.kitchen_sensor_temperature
      - type: template
        icon: mdi:water-percent
        icon_color: light-blue
        use_entity_picture: false
        content: '{{ states("sensor.kitchen_sensor_humidity")  |round() }}%'
        entity: sensor.kitchen_sensor_humidity
    alignment: center
    card_mod:
      style:
        mushroom-template-chip:nth-child(1)$: |
          ha-icon {
            {{ 'animation: open 6s ease-in-out infinite;' if is_state('binary_sensor.back_door_sensor_magnet_on_off', 'on') }}
            transform-origin: 30%;
          }
          @keyframes open {
            0%, 66% { transform: rotateY(0deg); }
            33% { transform: rotateY(-120deg); }
          }
          .shape {
            perspective: 45px;
          }
        mushroom-template-chip:nth-child(2)$: |
          ha-icon {
            {{ 'animation: clip 2s infinite;' if is_state('binary_sensor.kitchen_motion_group', 'on') }}
          }
          {% if is_state('binary_sensor.kitchen_motion_group', 'on') %}
            @keyframes clip {
              50% { clip-path: polygon(0 0, 55% 0, 100% 100%, 0 100%); }
            }
            .shape {
              animation: motion 2s linear infinite;
            }
            @keyframes motion {
              0%, 100% { --shape-color: rgba(var(--rgb-red), 0.3); }
              50% { --shape-color: rgba(var(--rgb-red), 0.2); }
            }
          {% endif %}
        .: |
          ha-card {
            --chip-box-shadow: none;
            --chip-background: none;
            --chip-spacing: 0;
            padding-top: 5px;
          }
  - type: custom:mushroom-template-card
    primary: Kitchen
    icon: mdi:countertop-outline
    tap_action:
      action: navigate
      navigation_path: /lovelace/kitchen
    card_mod:
      style:
        mushroom-state-info$: |
          .primary {
            font-size: 20px !important;
            position: absolute;
            top: 0px;
            left: 75px;
            overflow: visible !important;
            white-space: normal !important;
          }
        mushroom-shape-icon$: |
          .shape {
            position: relative;
            left: -30px;
            top: -0px;
            height: 20px;
            {% if is_state('light.kitchen_light_group', 'on') %}
               --shape-color: rgba(var(--rgb-orange), 0.25);
               --icon-color: rgba(var(--rgb-white), 1);
            {% endif %}
          }
        .: |
          :host {
            --mush-icon-size: 120px;
            --primary-text-color: #a0a0a0
          }
          ha-card {
            height: 75px !important;
          }
  - type: custom:stack-in-card
    cards:
      - type: grid
        square: false
        columns: 3
        cards:
          - type: custom:mushroom-template-card
            name: Coffee Machine
            entity: cover.kitchen_blind
            icon: |-
              {%  if is_state ('cover.kitchen_blind', 'open') %}
                mdi:blinds-open
              {% else %} 
                mdi:blinds
               {% endif %}  
            icon_color: |-
              {%  if is_state ('cover.kitchen_blind', 'open') %}
                grey
              {% else %} 
               purple
               {% endif %} 
            primary_info: none
            secondary_info: none
            layout: vertical
            tap_action:
              action: toggle
          - type: custom:mushroom-template-card
            name: Dishwasher
            entity: input_select.dishwasher_state_machine
            icon: mdi:dishwasher
            icon_color: '{{ ''light-blue'' if is_state(entity, ''job_ongoing'') else '''' }}'
            primary_info: none
            layout: vertical
            card_mod:
              style:
                mushroom-shape-icon$: |
                  ha-icon {
                    {{ '--icon-animation: bounce 1.5s ease-in-out infinite, wash 1s ease-in-out infinite;' if states('sensor.dishwasher_powee') | int > 5 }}
                    transform-origin: 50% 75%;
                  }
                  @keyframes bounce {
                    0%, 20%, 50%, 80%, 100% {transform: translateY(0); } 
                    40% { transform: translateY(-1.2px) rotate(5deg); } 
                    60% { transform: translateY(-1.1px) rotate(-4deg); } 
                  } 
                  @keyframes wash {
                    50%  { clip-path: polygon(0 0, 0 100%, 35% 100%, 36% 74%, 31% 43%, 61% 40%, 71% 69%, 62% 78%, 36% 73%, 35% 100%, 100% 100%, 100% 0); }
                  }
                .: |
                  ha-card:active {
                    background: rgba(var(--rgb-disabled), 0.1);
                    transform: scale(0.975);
                    transition: 0s;
                  }
          - type: custom:mushroom-template-card
            name: Quooker Tap
            icon: mdi:speaker
            entity: media_player.kitchen_sonos
            icon_color: '{{ ''green'' if is_state(entity, ''playing'') else ''disabled'' }}'
            primary_info: none
            secondary_info: none
            layout: vertical
            card_mod:
              style:
                mushroom-shape-icon$: |
                  .shape {
                    --icon-animation: beat 1.3s ease-out infinite both;
                    transform-origin: 50% 60%;
                  }
                  @keyframes beat {
                    0% { transform: scale(1); }
                    10% { transform: scale(1.1); }
                    17% { transform: scale(1.05); }
                    33% { transform: scale(1.25); }
                    60% { transform: scale(1); }                    
                  }
      - type: grid
        square: false
        columns: 1
        cards:
          - type: custom:stack-in-card
            cards:
              - type: custom:layout-card
                layout_type: custom:grid-layout
                layout:
                  grid-template-columns: auto 33px
                  margin: '-4px -4px -8px -4px;'
                cards:
                  - type: custom:mushroom-template-card
                    primary: Kitchen
                    icon: mdi:toggle-switch-outline
                    entity: light.kitchen_light_group
                    icon_color: '{{ ''orange'' if is_state(entity, ''on'') else ''disabled'' }}'
                    fill_container: false
                    multiline_secondary: false
                    card_mod:
                      style: |
                        ha-card {
                          background: none;
                          --ha-card-box-shadow: 0px;
                        }
                  - type: custom:mushroom-template-card
                    entity: input_boolean.kitchen_lights
                    primary: ''
                    secondary: ''
                    icon: >-
                      {{ 'mdi:chevron-up' if is_state(entity, 'on') else
                      'mdi:chevron-down' }}
                    icon_color: disabled
                    hold_action:
                      action: none
                    card_mod:
                      style: |
                        ha-card {
                          align-items: flex-end;
                          background: none;
                          --ha-card-box-shadow: 0px;
                        }
                        mushroom-shape-icon {
                          --shape-color: none !important;
                        }  
              - type: conditional
                conditions:
                  - entity: input_boolean.kitchen_lights
                    state: 'on'
                card:
                  type: custom:stack-in-card
                  columns: 4
                  mode: horizontal
                  keep:
                    background: true
                    border_radius: true
                    margin: true
                  cards:
                    - type: custom:mushroom-light-card
                      name: Lights
                      entity: light.kitchen_spotlights
                      icon: mdi:lightbulb-spot
                      primary_info: none
                      secondary_info: none
                      layout: vertical
                      card_mod: null
                      style: |
                        ha-card {
                          box-shadow: 0px 0px;
                        }
                    - type: custom:mushroom-light-card
                      name: LEDs
                      entity: light.kitchen_leds
                      icon: |-
                        {% if is_state('light.kitchen_leds','on') %}
                          mdi:led-strip-variant
                        {% else %}
                          mdi:led-strip-variant-off
                        {% endif %}
                      show_brightness_control: false
                      show_color_control: false
                      collapsible_controls: false
                      use_light_color: true
                      primary_info: none
                      secondary_info: none
                      layout: vertical
                      card_mod:
                        style: |
                          ha-card:active {
                            background: rgba(var(--rgb-disabled), 0.1);
                            transform: scale(0.975);
                            transition: 0s;
                          }
                          mushroom-shape-icon {
                            {% if is_state(config.entity, 'on') %}
                              --card-mod-icon: mdi:led-strip-variant;
                            {% else %}
                              --card-mod-icon: mdi:led-strip-variant-off;
                            {% endif %}
                          }
                    - type: custom:mushroom-light-card
                      name: Wall LEDs
                      entity: light.kitchen_wall_leds
                      show_brightness_control: true
                      collapsible_controls: true
                      primary_info: none
                      secondary_info: none
                      layout: vertical
                      card_mod:
                        style: |
                          mushroom-shape-icon {
                            {% if is_state(config.entity, 'on') %}
                              --card-mod-icon: 
                              {% set light_level = ((state_attr(config.entity, "brightness") / 255) * 10) | round(0) * 10 %}
                              {% if light_level == 100 %}
                                mdi:lightbulb-on
                              {% elif light_level > 0 %}
                                mdi:lightbulb-on-{{ light_level }}
                              {% else %}
                                mdi:lightbulb-on-outline
                              {% endif %};
                            {% else %}
                              --card-mod-icon: mdi:lightbulb-outline;
                            {% endif %}
                          }
                          ha-card {
                            box-shadow: 0px 0px;
                          }
                    - type: custom:mushroom-light-card
                      name: Ceiling LEDs
                      entity: light.kitchen_ceiling_leds
                      show_brightness_control: true
                      collapsible_controls: true
                      primary_info: none
                      secondary_info: none
                      layout: vertical
                      card_mod:
                        style: |
                          mushroom-shape-icon {
                            {% if is_state(config.entity, 'on') %}
                              --card-mod-icon: 
                              {% set light_level = ((state_attr(config.entity, "brightness") / 255) * 10) | round(0) * 10 %}
                              {% if light_level == 100 %}
                                mdi:lightbulb-on
                              {% elif light_level > 0 %}
                                mdi:lightbulb-on-{{ light_level }}
                              {% else %}
                                mdi:lightbulb-on-outline
                              {% endif %};
                            {% else %}
                              --card-mod-icon: mdi:lightbulb-outline;
                            {% endif %}
                          }
                          ha-card {
                            box-shadow: 0px 0px;
                          }
                state_color: true
                show_header_toggle: false

Credit for the card goes to @danwooller

Thanks! It works :slight_smile:

--primary-text-color: #FF0000;
--secondary-text-color: #00FF00;

That is perfect! Thank you!

EDIT: Actually, this is not working for me. The select card is still showing below the light card and the select options are still constrained. I copied your code exactly and replaced with my own entities. Thoughts?

EDIT 2: Nevermind. I just needed to add card-mod to my frontend. Thanks again!

2023-02-20 08_44_01-Window

type: custom:stack-in-card
cards:
  - type: custom:mushroom-light-card
    entity: light.office_light
    show_brightness_control: true
    use_light_color: true
    show_color_control: true
    card_mod:
      style: |
        ha-card {
          --ha-card-border-width: 0;
        }
  - type: custom:mushroom-select-card
    entity: input_select.office_light
    icon_type: none
    secondary_info: none
    primary_info: none
    card_mod:
      style: |
        ha-card {
          position: absolute;
          top: 0px;
          right: 0px;
          width: 50%;
          --ha-card-border-width: 0;
        }
card_mod:
  style: |
    :host {
      border-radius: var(--ha-card-border-radius, 12px);
      background: var(--card-background-color);
    }
    ha-card {
      overflow: visible !important;
      {% if is_state('light.office_light', 'on') %}
        background: {{ '#%02x%02x%02x13' % state_attr('light.office_light', 'rgb_color') }};
      {% endif %}
    }

1 Like

When using the humidity card, is there a way to offset the output value?

I have a small zigbee humidifier inside of my cigar humidor that works great but it reads 3% higher than what the humidity actually is.

This is actually really great. It is exactly what I was looking for with my lights. The background color is a nice touch.

I was also able to use the same technique to modify the fan card with fan presets. Of course I’m not skilled enough to quickly modify the fancy backround css but it is exactly what I needed.

2023-02-20 09_55_13-Window

cards:
  - type: custom:mushroom-fan-card
    entity: fan.living_room_fan
    icon_animation: true
    show_percentage_control: false
    show_oscillate_control: false
    collapsible_controls: false
    card_mod:
      style: |
        ha-card {
          --ha-card-border-width: 0;
        }
  - type: custom:mushroom-select-card
    entity: input_select.living_room_fan_preset_mode
    icon_type: none
    secondary_info: none
    primary_info: none
    card_mod:
      style: |
        ha-card {
          position: absolute;
          top: 0px;
          right: 0px;
          width: 50%;
          --ha-card-border-width: 0;
        }
card_mod:
  style: |
    :host {
      border-radius: var(--ha-card-border-radius, 12px);
    }
    ha-card {
      overflow: visible !important;
    }

2 Likes

Pasted complete and only the entity: changed to a sensor from my system :upside_down_face:

Do you have card-mod installed?

No :upside_down_face:

Remove the height: 20px like this:

       mushroom-shape-icon$: |
          .shape {
            position: relative;
            left: -30px;
            top: 0px;
            {% if is_state('light.kitchen_light_group', 'on') %}
               --shape-color: rgba(var(--rgb-orange), 0.25);
               --icon-color: rgba(var(--rgb-white), 1);
            {% endif %}
          }
1 Like

Try using stack-in-card instead of vertical-stack-in-card.