Mushroom Cards Card Mod Styling/Config Guide

I’m trying to increase the text size in a drop-down menu, but it’s not working. Can you tell me how to do this in a select card?

type: custom:mushroom-select-card
entity: select.x50_ultra_complete_cleaning_mode
layout: horizontal
name: Dreame X50
card_mod:
style: |
ha-tile-info {
–tile-info-primary-font-size: 22px;
–tile-info-secondary-font-size: 14px;
}
ha-select {
–mdc-typography-body1-font-size: 18px;
–mdc-typography-subtitle1-font-size: 18px;
}
ha-select mwc-list-item,
ha-select ha-list-item {
–mdc-typography-body1-font-size: 18px;
font-size: 18px !important;
}

This will get you started

type: custom:mushroom-select-card
entity: select.x50_ultra_complete_cleaning_mode
layout: horizontal
name: Dreame X50
card_mod:
  style:
    mushroom-select-option-control$:
     ha-control-select-menu$: 
      ha-dropdown-item$: |
       #label{
        color: green;
        font-size: 10px;
           }
    mushroom-state-info$: |
      .container {
       --card-primary-font-size: 20px;
       --card-secondary-font-size: 12px;
      }

Found a bug.

I was trying to change the --primary-text-color and --secondary-text-color of mushrom-template-card. The --primary-text-color works, but the --secondary-text-color always get the same color as the --primary-text-color.

I used Dev Tools to peek the CSS and found this bug:

That should be --secondary-text-color.

I don’t know how to report this bug to the dev team. Note, I am using 2026.2.3 core version.

So, I am using this as workaround:

          card_mod:

            style: |

              :host {

              --ha-tile-info-primary-color: #FFFFFF;

              --ha-tile-info-secondary-color: #999999;

              }

That is on Mushroom? Then go to the repo and file an issue, by clicking the Issue tab and click New Issue, then follow the template you need to fill out. Should be painless and self explanatory

Style does come from Frontend but also there is a note in the file that this is by design.

So your override is needed as expected if you wish to have it as different color. I suppose the reasoning is that for tile, secondary is smaller font and condensed line height, but not a different color.

1 Like

Guys, i’ve been trying to change the color of the icon background circle for Mushroom Template card with the code like this (as mentioned in one of the first posts):

card_mod:
  style:
    mushroom-shape-icon$: |
      .shape {
        --shape-color: orange !important;
      }

But it looks like the Template card just does not have this shape, because other cards like Entity work fine. Is this a bug or the Template card is just special and my idea is not going to work?

I have HA 2026.3.1, Mushroom 5.1.1, card-mod 4.2.1.

Mushroom v5 change template to more align with Frontend so no longer mushroom-shape-icon

Easy here is to use the CSS var avauilable so…

type: custom:mushroom-template-card
primary: Hello, {{user}}
secondary: How are you?
icon: mdi:mushroom
features_position: bottom
badge_text: "1"
card_mod:
  style: |
    :host {
      --badge-color: red;
    }

Thank you for the answer. However, I want to change the color of the round icon background, not the badge. How do I do this for a Template color after the v5 changes? o.O

Alright, I hacked it to what I need

card_mod:
  style:
    .: |
      ha-tile-icon {
        background: orange !important;
        border-radius: 100px !important;
        padding: 0px !important;
        margin: 0px !important;
      }

Sad that all AI is trained on old data…

Hello everyone,

I’m building a dashboard using the custom button-card as the base card. Then I add custom_fields to place the different cards in the dashboard.
One of these fields uses mushroom-number-cards to display a few sliders in button mode.
Here is a snapshot:

Here is my code to produce it:

  Instruments:
    card:
      type: custom:stack-in-card
      cards:
        - type: custom:mushroom-title-card
          title: Cabine
          alignment: center
          title_tap_action:
            action: none
          subtitle_tap_action:
            action: none
          card_mod:
            style: |
              ha-card {
                padding-top: 0px !important;
                padding-bottom: 0px !important;
                --title-font-size: 18px !important;
                height: 30px !important;
                border: white solid 1px !important;
              }
        - type: custom:stack-in-card
          mode: horizontal
          cards:
            - type: custom:mushroom-entity-card
              entity: sensor.ram_vsim_cabin_temperature
              primary_info: state
              secondary_info: none
              tap_action:
                action: none
              hold_action:
                action: none
              double_tap_action:
                action: none
              card_mod:
                style: |
                  ha-card {
                    text-align: left !important;
                    height: 40px !important;
                    border: white solid 1px !important;
                  }
            - type: custom:mushroom-entity-card
              entity: sensor.ram_vsim_cabin_humidity
              primary_info: state
              secondary_info: none
              tap_action:
                action: none
              hold_action:
                action: none
              double_tap_action:
                action: none
              card_mod:
                style: |
                  ha-card {
                    text-align: left !important;
                    height: 40px !important;
                    border: white solid 1px !important;
                  }
        - type: custom:mushroom-title-card
          title: Frigo
          alignment: center
          title_tap_action:
            action: none
          subtitle_tap_action:
            action: none
          card_mod:
            style: |
              ha-card {
                padding-top: 0px !important;
                padding-bottom: 0px !important;
                --title-font-size: 18px !important;
                height: 30px !important;
                border: white solid 1px !important;
              }
        - type: custom:stack-in-card
          mode: horizontal
          cards:
            - type: custom:mushroom-entity-card
              entity: sensor.instruments_temperature
              primary_info: state
              secondary_info: none
              tap_action:
                action: none
              hold_action:
                action: none
              double_tap_action:
                action: none
              card_mod:
                style: |
                  ha-card {
                    text-align: left !important;
                    height: 90px !important;
                    border: white solid 1px !important;
                  }
            - type: custom:stack-in-card
              cards:
                - type: custom:mushroom-number-card
                  entity: input_number.instruments_temperature_threshold_low
                  layout: horizontal
                  display_mode: buttons
                  primary_info: none
                  secondary_info: none
                  icon: mdi:thermometer-minus
                  tap_action:
                    action: none
                  hold_action:
                    action: none
                  double_tap_action:
                    action: none
                  card_mod:
                    style:
                      mushroom-number-value-control$: |
                        mushroom-input-number {
                          font-size: 14px;
                        }
                      .: |
                        ha-card {
                          text-align: left !important;
                          height: 40px !important;
                          border: white solid 1px !important;
                        }
                - type: custom:mushroom-number-card
                  entity: input_number.instruments_temperature_threshold_high
                  layout: horizontal
                  display_mode: buttons
                  primary_info: none
                  secondary_info: none
                  icon: mdi:thermometer-plus
                  tap_action:
                    action: none
                  hold_action:
                    action: none
                  double_tap_action:
                    action: none
                  card_mod:
                    style:
                      mushroom-number-value-control$: |
                        mushroom-input-number {
                          font-size: 14px;
                        }
                      .: |
                        ha-card {
                          text-align: left !important;
                          height: 40px !important;
                          border: white solid 1px !important;
                        }
        - type: custom:stack-in-card
          mode: horizontal
          cards:
            - type: custom:mushroom-entity-card
              entity: sensor.instruments_fans_rpm
              primary_info: none
              secondary_info: state
              tap_action:
                action: none
              hold_action:
                action: none
              double_tap_action:
                action: none
              card_mod:
                style: |
                  ha-card {
                    text-align: left !important;
                    height: 90px !important;
                    border: white solid 1px !important;
                  }
            - type: custom:stack-in-card
              cards:
                - type: custom:mushroom-fan-card
                  entity: fan.instruments_fans
                  primary_info: state
                  secondary_info: none
                  tap_action:
                    action: toggle
                  hold_action:
                    action: none
                  double_tap_action:
                    action: none
                  card_mod:
                    style: |
                      ha-card {
                        text-align: left !important;
                        height: 40px !important;
                        border: white solid 1px !important;
                      }
                - type: custom:mushroom-entity-card
                  entity: sensor.instruments_fans_pwm_duty_cycle
                  primary_info: state
                  secondary_info: none
                  tap_action:
                    action: none
                  hold_action:
                    action: none
                  double_tap_action:
                    action: none
                  card_mod:
                    style: |
                      ha-card {
                        text-align: left !important;
                        height: 40px !important;
                        border: white solid 1px !important;
                      }

For the button sliders, I would like to move the minus sign closer to the icon and place the value evenly between the minus sign and the plus sign.
Is it possible?
Thanks for your help.

p.s. Also, for the entity “sensor.instruments_fans_rpm”, is it possible to only get the value (0.00) and not the units (RPM)?

Hi Everyone. I’m trying to re create this example card from the Expander Card github page.

I have gotten very close, but I keep getting the drop shadows around the chips, which if you look closely you can see faintly here:

I have tried a ton of things to get rid of them with card-mod, but so far the only thing that works is to put the following in my theme.
mush-chip-box-shadow: “none”
mush-chip-border-color: “transparent”

Of course I don’t like this because it will remove them from all mushroom chip cards which I
don’t want to do. Does anyone have any idea how to properly apply this change with card-mod? My full card code is here, but the only thing I’m trying to style is the chips at the end:


  - type: custom:expander-card
    child-margin-top: 0.6em
    padding: 0
    clear: true
    title-card-button-overlay: true
    title-card-clickable: true
    expanded: true
    title-card:
      type: custom:vertical-stack-in-card
      cards:
        # --- TOP ROW ---
        - type: horizontal-stack
          cards:
          
            - type: custom:mushroom-template-card
              primary: Living Room
              icon: mdi:sofa
              layout: vertical
              card_mod:
                style:
                  mushroom-shape-icon$: |
                    .shape {
                      background: none !important;
                      --shape-color: transparent !important;
                    }
                  .: |
                    ha-card {
                      background: none !important;
                      border: none !important;
                      box-shadow: none !important;
                      /* This moves the entire card (icon + text) up by 6px */
                      margin-top: -15px !important; 
                    }
                    mushroom-state-info {
                      margin-top: -25px !important; /* Keeps the tight text-to-icon gap */
                    }
                    mushroom-state-item {
                      gap: 0px !important;
                    }
                    :host {
                      --mush-icon-size: 70px;
                      --primary-text-color: white;
                      --primary-font-weight: 660;
                    }

            - type: custom:mushroom-light-card
              entity: light.fibaro_dimmer_2_living_room_spotlight
              name: Lights
              card_mod:
                style: |
                  ha-card {
                    background: none !important;
                    border: none !important;
                    box-shadow: none !important;
                    /* Reduced from 35px to 18px */
                    margin-top: 8px !important; 
                    /* Ensures the card doesn't cut off the text */
                    width: 100% !important;
                  }
              
        # --- BOTTOM ROW (Chips) ---
        - type: custom:mushroom-chips-card
# remember you disabled the drop shadows from all mushroom cards in your themes to get rid of them here
          alignment: center
          chips:
            - type: template
              icon: mdi:thermometer
              icon_color: orange
              content: "21.71 °C"
            - type: template
              icon: mdi:water-percent
              icon_color: blue
              content: "44.89 %"
            - type: template
              icon: mdi:gauge
              icon_color: red
              content: "974.3 hPa"
            - type: template
              icon: mdi:flash
              icon_color: yellow
              content: "357 W"

Thanks in advance for any ideas you may have.

Im using uix now rather than card mod, but should work exactly the same if you replaced the uix: with card_mod:

        type: custom:mushroom-chips-card
          alignment: center
          chips:
            - type: template
              icon: mdi:thermometer
              icon_color: orange
              content: "21.71 °C"
              uix:
                style: |
                  ha-card {
                    box-shadow: none !important;
                  }

Ah yes, we are finally onto something. Thanks for the quick reply!! I didn’t consider putting them under the chips themselves rather than for the card as a whole. So, your suggestion did get rid of the box-shadow, but there is still a faint border. I tried
border-color: "transparent" !important
but it didn’t work. Any ideas?

Here’s how it stands now (drop shadow gone only from first chip, but thin border remains)

Current code:

        - type: custom:mushroom-chips-card
          alignment: center
          chips:
            - type: template
              icon: mdi:thermometer
              icon_color: orange
              content: "21.71 °C"
              card_mod:
                style: |
                  ha-card {
                    box-shadow: none !important;
                  }
            - type: template
              icon: mdi:water-percent
              icon_color: blue
              content: "44.89 %"
            - type: template
              icon: mdi:gauge
              icon_color: red
              content: "974.3 hPa"
            - type: template
              icon: mdi:flash
              icon_color: yellow
              content: "357 W"

Okay. It’s just border. So the final solution looked like this:

                style: |
                  ha-card {
                    box-shadow: none !important;
                    border: none !important;
                  }

Thank you Dimitri!

This is an excellent guide. I have very little CSS experience, so this was very useful to me.

I’m trying to center align the secondary contents of a mushroom entity card. Are there any options like --card-secondary-align: center; ? Is there documentation of what’s available within .container?

Never mind. I figured it out with the help of ChatGPT

card_mod:
style:
mushroom-state-info$: |
.container {
–card-primary-font-size: 20px;
–card-secondary-font-size: 30px;
–card-secondary-line-height: 50px;
}
.secondary {
text-align: center;
}

.secondary was the solution

Hi. I noticed a visual discrepancy between Entity and Template cards:

While the Entity card (right) has a circular background, the Template card (left) does not. I couldn't find a setting/key to enable it in the Template card.

I'd like to fix it with card-mod. I have tried several things, to no avail. Any help would be appreciated :slight_smile:

edit: I have tried adding the force_circular_background: true key to the Yaml. It works in the Entity card, but not in the Template card (throws schema validation error).

Mushroom template uses standard tile icon and will only have a background if it has an action. So easiest way to get a background is to set an icon tap action, which can be perform-action with no actual perform_action key if you don't want an action. If you are then just setting the dummy action to get background you can then stop any interaction by setting pointer-events as shown in the example below.

Of course, if you set an actual valid icon tap action you don't need to worry about stopping pointer-events.

type: custom:mushroom-template-card
primary: Hello, {{user}}
secondary: How are you?
icon: mdi:mushroom
icon_tap_action:
  action: perform-action
card_mod:
  style:
    .: |
      ha-tile-icon {
        pointer-events: none !important;
      }
    ha-tile-icon $: |
      div.container {
        pointer-events: none;
      }

The other method is to actually set styling on ::before for the ha-tile-icon container, which is what Frontend does when there is an icon tap action.

type: custom:mushroom-template-card
primary: Hello, {{user}}
secondary: How are you?
icon: mdi:mushroom
card_mod:
  style:
    ha-tile-icon $: |
      div.container::before {
        content: "";
        position: absolute;
        top: 0px;
        left: 0px;
        height: 100%;
        width: 100%;
        background-color: var(--tile-icon-color);
        transition: background-color 180ms ease-in-out, opacity 180ms ease-in-out;
        opacity: var(--tile-icon-opacity);
      }
2 Likes

I’m trying to overlay a live status image over the picture entity using the mushroom entity card + card-mod as that’s what seems to be the suggestion, but I’m getting no way. I’m happy to try other cards, solutions, put if possible I’d like to keep the picture-entity.

I’m using the Twitch integration that provides the sensor.

Here’s the code I’ve tried:

type: custom:mushroom-entity-card
entity: sensor.trucker_dylan
tap_action:
  action: none
hold_action:
  action: none
double_tap_action:
  action: none
icon_type: entity-picture
card_mod:
  style: |
    ha-card {
      position: relative;
      overflow: hidden;
    }
    ha-card::after {
      content: "";
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background-image: url('/local/Twitch/live-overlay.png');
      background-size: contain;
      background-repeat: no-repeat;
      background-position: center;
      opacity: 0;
      transition: opacity 0.3s;
      pointer-events: none;
      {% if is_state(entity, 'Streaming') %}
      opacity: 1;
      {% endif %}
    }

Here’s what I get:

image

And here’s a mock up of how I want it to look like:

image

The original overlay image is 512px so might be there, but coz it’s a circle, could be “out of shot” but from what I gather, background-size: contain; should resize and bound it to the icon size. I’ve since tested a square image.

I could just create 2 images and force it another way, but I want to try to use an overlay method so I can reuse it on multiple entities if I want. I’m open to any solution, any card if there’s a better way, as long as the icon pulls from the entity.

Edit:

After more digging around, UI eXtension has superseded card-mod, I’ve confirmed UIX works by successfully changing the card background color. I’m also testing with Tile card, but same behaviour.

Here’s my UIX adjusted code:

type: custom:mushroom-entity-card
entity: sensor.trucker_dylan
tap_action:
  action: none
hold_action:
  action: none
double_tap_action:
  action: none
icon_type: entity-picture
uix:
  style: |
    ha-card {
      position: relative;
      overflow: hidden;
    }
    .content .entity-picture {
      position: relative;
      width: 100%;
      height: 100%;
    }
    .content .entity-picture::after {
      content: "";
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background-image: url('/local/Twitch/live-overlay.png');
      background-size: contain;
      background-position: center;
      background-repeat: no-repeat;
      pointer-events: none;
      z-index: 5;
      {% if is_state(entity, 'Streaming') %}
      opacity: 1;
      {% endif %}
    }

OK update, after hours, and going back to it several times, and asking Brave’s AI, (I hate AI - but I also want to pass on what I learned, rather than what I get off some people “just use AI”, yeah that doesn’t help solve anything), anyway back on track, I finally got what I wanted in a roundabout way, thinking creatively and using what I’d learned on other projects.

Short of it is, I’m not sure it can be done with the current Mushroom or Tile cards, due to architectural limitations and Shadow DOM Encapsulation, where UI eXtension style: can’t penetrate certain selectors like ::after and $. Please do correct me if I’m wrong and there is a way to do it in Mushroom and Tile.

So, what I thought about doing is using Bubble Card coz it has sub buttons, and I can move the sub button, on the right by default to be behind the entity-picture and then make it slightly bigger for a red circle outline, but this was initially done with manual positioning, which wasn’t good when in different monitor sizes, or moved to different areas on the Dashboard, I later implemented it to force the sub button to the left, then I fine tuned it from a left margin to be exactly over the icon/picture.

In between I remembered you can replace icons with images after flex-horseshoe-card implemented it in one of his recent dev releases, so I did that and changed the z-index so the icon/image is now on top of the entity-picture.

I also figured out Streaming does actually mean ‘on’, so I used ‘on’ instead of ‘Streaming’, and because I’m using 2 buttons, I’m also now using binary_sensor.streamer_live to drive the ‘on’ state for the image rather than sensor.streamer, I found Running = ‘on’ in the binary sensor triggered the on state for the image, whereas the sensor.streamer Streaming = ‘on’ did not.

Here’s my working code, I’ve left the AI annotations there in case it helps anyone finding this post, the grid code at the bottom is purely to limit the width on my dashboard, and the scrolling_effect needs to be false, otherwise the card does weird stuff and rapidly pushes everything to the right:

type: custom:bubble-card
card_type: button
entity: sensor.trucker_dylan
icon_type: entity-picture
show_state: true
sub_button:
  - entity: binary_sensor.trucker_dylan_live
    icon: mdi:camera-image
    show_background: false
    show_name: false
    show_state: false
    tap_action:
      action: none
styles: |
  /* 1. Detach the container from the right side and move it to the left */
  .bubble-sub-button-container {
    position: absolute !important; /* Force absolute positioning */
    left: 7px !important;         /* Pin to the left edge (adjust margin as needed) */
    right: inherit !important;     /* CRITICAL: Remove the default 'right: 10px' */
    bottom: 4px !important;       /* Optional: Pin to bottom if desired, or remove for vertical center */
    justify-content: flex-start !important; /* Align items to the start (left) */
    width: auto !important;        /* Allow width to shrink to content */
    z-index: 10 !important;
  }

  /* 2. Your Overlay Logic (Replacing Icon with Image) */
  ${subButtonIcon[0].setAttribute("icon", "")}

  .bubble-sub-button-1 {
    display: ${hass.states['binary_sensor.trucker_dylan_live'].state === 'on' ? 'flex' : 'none'} !important;
    background-image: url('/local/Twitch/live-overlay.png') !important;
    background-size: contain !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    width: 46px !important;
    height: 46px !important;
    border-radius: 50% !important;
    z-index: 100 !important;
    position: relative !important;
  }

  .bubble-sub-button-1 ha-icon {
    display: none !important;
  }

  /* 3. Adjust Main Icon if it overlaps */
  .bubble-icon {
    width: 48px !important;
    height: 48px !important;
  }
button_type: state
scrolling_effect: false
grid_options:
  columns: 6
  rows: auto

Here’s 2 examples with offline and streaming states:

image

I might add a blink-animate at some point that lasts for 5 mins when ‘on’ is detected, looks easy enough to do, just need to add an input_boolean to limit the animation, but a mini project for another day, I’ll see if I need it first.