Mushroom Cards - Build a beautiful dashboard easily šŸ„ (Part 1)

Ok I seem to have found the issue on a test dashboard where it works amazingly. Basically, my dashboard doesnā€™t go all the way to the bottom so it doesnā€™t overlay, I now need to try and fix that with more cards I guess lol greatā€¦

Test lovelace dashboard

My current dashboard:

2 Likes

Is the chips type limited somehow? I canā€™t get a template inside a chip to display a name or a badge. See the following code:

      - type: custom:mushroom-chips-card
        alignment: end
        chips:
          # Person
          - type: template
            entity: person.some_person
            multiline_secondary: true
            primary: Some Person
            secondary: Some Person
            icon: mdi:face-man-profile
            icon_color: |-
              {% if is_state('person.some_person', 'home') %}
                green
              {% else %}
                grey
              {% endif %}
            badge_icon: >
              {% if is_state('person.some_person', 'home') %} 
                mdi:home-circle
              {% endif %}
              badge_color: red

and this is all I get from the above snippet:

image

what I am missing here? :thinking:

Your idea works within the layout-card. To sticky the entire layout-card you can do like this:

type: custom:mod-card
card:
  type: custom:layout-card
  layout_type: custom:grid-layout
  layout:
    mediaquery:
      '(max-width: 800px)':
        grid-template-rows: auto
        grid-template-columns: 1fr
        overflow: auto;
        grid-template-areas: |
          "header"
          "main"
          "footer"
  cards:
    - type: custom:mushroom-template-card
      primary: Mushroom
      icon: mdi:mushroom
      icon_color: red
      view_layout:
        grid-area: header
        show:
          mediaquery: '(max-width: 800px)'
    - type: custom:mushroom-template-card
      primary: Mushroom
      icon: mdi:mushroom
      icon_color: red
      view_layout:
        grid-area: main
        show:
          mediaquery: '(max-width: 800px)'
    - type: custom:mushroom-template-card
      primary: Mushroom
      icon: mdi:mushroom
      icon_color: red
      view_layout:
        grid-area: footer
        show:
          mediaquery: '(max-width: 800px)'
card_mod:
  style: |
    :host {
      position: sticky;
      bottom: 12px;
    }
1 Like

You seem to be conflating Chips & Cards. Chips donā€™t have badges and have a single line content: instead of primary: and secondary:. There are some tricks to add a badge to Chips with CSS, have a look at some of my posts.

What are you trying to do?

Hi, someone help how make template for calendars, i need a template where the calendar events will change every 10 seconds (5calendars in 1template), and this template i want put in Mushroom Title.
image
i want connect more calendars in one title (change every 10 seonds)

This should help:

type: custom:mushroom-chips-card
chips:
  - type: conditional
    conditions:
      - entity: sensor.plex_dc_nashost
        state_not: '0'
    chip:
      type: template
      icon: mdi:plex
      icon_color: orange
      tap_action:
        action: fire-dom-event
        browser_mod:
          service: browser_mod.popup
          data:
            title: Plex monitor
            content:
              type: custom:stack-in-card
              cards:
                - type: custom:mushroom-entity-card
                  entity: sensor.plex_dc_nashost
                  name: Users
                  icon: mdi:plex
                  icon_color: '#e5a00d'
                - type: custom:mushroom-entity-card
                  entity: sensor.tautulli_total_bandwidth
                  name: Bandwith
                  icon: mdi:lan
                  icon_color: '#e5a00d'
                - type: custom:mushroom-entity-card
                  entity: sensor.tautulli_top_movie
                  name: Top Movie
                  icon: mdi:movie-filter
                  icon_color: '#e5a00d'
                - type: custom:mushroom-entity-card
                  entity: sensor.tautulli_top_tv_show
                  name: Top Series
                  icon: mdi:filmstrip
              card_mod:
                style: |
                  ha-card {
                    --ha-card-background: none;
                    --ha-card-box-shadow: none;
                    --ha-card-border-width: 0;
                  }
      card_mod:
        style: |
          ha-card:after {
            content: "{{ (states.sensor.plex_dc_nashost.state | int) }}";
            position: absolute;
            display: flex;
            justify-content: center;
            align-items: center;
            background: rgb(255, 191, 0);
            color: var(--card-background-color);
            font-weight: bolder;
            border-radius: 50%;
            top: -5px;
            right: -5px;
            width: 16px;
            height: 16px;
            font-size: 11px; 
          }
1 Like

@rhysb long time no speak mate!

Can you assist me in duplicating the Number card as a Volume card? My first idea was to create a Template card utilizing the amplifierā€™s volume attribute and the Media card, omitting the icon and information. Do you happen to know a more effective method?

Got:
Current

Want:
New

Is this what you wanted?

hey, what if I would like to set the counter / reminder for the last day of the month ?
Letā€™s say I want the countdown to be equal to the number of days each month

Is it achievable :)?

Sorry, I didnā€™t mean the card mod for the icon, I meant stacking together the Template card with the Media card.

Perhaps like this.

Mushroom Month End Countdown:

type: custom:mushroom-template-card
icon: mdi:calendar-end
primary: Month End Countdown
icon_color: orange
secondary: >
  {% set month_days = (31 if now().month == 12 else
  (now().replace(month=now().month+1, day=1) - timedelta(days=1)).day) %}

  {{ now().day }}/{{ month_days }} Days | {{ ((month_days - now().day) /
  month_days * 100) | round(2) }}%
card_mod:
  style:
    mushroom-shape-icon$: |
      .shape {
        {% set month_days = (31 if now().month == 12 else (now().replace(month=now().month+1, day=1) - timedelta(days=1)).day) %}
        
        background: radial-gradient(var(--card-background-color) 60%, transparent calc(60% + 1px)), 
                    conic-gradient(rgb(var(--rgb-{{ config.icon_color }})) 
                    {{ ((month_days - now().day) / month_days * 100) | round(2) }}% 0%, 
                    var(--card-background-color) 0% 100%);
      }
      .shape:after {
        content: "";
        height: 100%;
        width: 100%;
        position: absolute;
        border-radius: var(--icon-border-radius);
        background: rgba(var(--rgb-{{ config.icon_color }}), 0.2);
      }

Credit to @123 for the Month Days template code

9 Likes

Is this more like it? :thinking:

type: custom:stack-in-card
mode: horizontal
cards:
  - type: custom:mushroom-template-card
    primary: Volume
    secondary: '{{ (state_attr(entity, ''volume_level'') * 100) | round(0) }}%'
    icon: mdi:volume-high
    entity: media_player.currently_playing
    icon_color: indigo
  - type: custom:mushroom-media-player-card
    entity: media_player.currently_playing
    icon_type: none
    primary_info: none
    secondary_info: none
    volume_controls:
      - volume_set
1 Like

This is just remarkable, thank you!

1 Like

You are a legend!

Last question, how do I change the slider colour? :thinking:

3 Likes

I finally found the solution.
I removed the swipe_nav function in the dashboard code:

swipe_nav:
  wrap: false
  animate: swipe
  skip_tabs: null
  prevent_default: true
  swipe_amount: 20
1 Like

I donā€™t know why the sticky css is not working with custom-ui (yaml dashboard) when I use Lovelace-UI it works. Have to figure it out. You are using only Lovelace-UI or?

This worked, thanks alot @rhysb!

1 Like

nice man & can you share you full card pleas

Hello,

I have this card, where I would like the lamp color to appear on the card background image.

Instead of the fixed RGB that is there right now.

Do you have any tips on how I can achieve this?

asdf

type: custom:mushroom-light-card
entity: light.vagglampa
name: Hall
show_brightness_control: true
show_color_temp_control: true
show_color_control: true
tap_action:
  action: toggle
icon: mdi:hanger
hide_state: true
card_mod:
  style: |
    :host { 
      {% if is_state('light.vagglampa', 'on') %}
        --mush-card-primary-font-weight: 450;
        --mush-rgb-state-light: 255, 255, 255;;
      {% endif %}
    }        
      ha-card {
        --control-height: 27px;
        {% if is_state('light.vagglampa','on') %}
        background: radial-gradient(at bottom, rgba(255,255,255, 0.26) 0%, rgba(43,55,78,0) 70%);
        background-size: 140% 70%;
        background-repeat: no-repeat;
        background-position: 50% 100%;
        background-color: var(--light-card);
        {% else %}
        background-color: var( --ha-card-background, var(--card-background-color, white) );
        background-size: 140% 70%;
        background-position: 50% 360%;
        {% endif %}        
      }

1 Like