Hi,
I am looking for a way to dynamically align my stacked cards (using custom stack-in card) so that there is always a constant margin between the cards.
system info:
The context
I want to recreate a card similar to this button card with subbuttons.(dont mind the colors please). I base myself mainly on mushroom cards within a custom:stack-in card (button card is too limited with templating etc…).
Example I want to recreate:

The issue
Everything worked out quite nicely, howevever I dont seem to be able to align the ‘subbuttons’ when using the custom:stack-in card. I have the feeling this needs to be done with advanced CSS using e.g. flex-grow in the right container but I don’t seem to be able to get there.
Below is as far as I got (basically using card-mod with fixed positioning as this overrides the 3 equal columns generated by the stack-in card. Obviously the moment the values change the mushroom cards will adjust their size and the margin between them will also change, which is what I want to avoid (dont mind the colors and icons etc, this is something I can work out). the issue is with the two ‘subbuttons’ on the right (or more if I want to add more).

type: custom:stack-in-card
mode: horizontal
card_mod:
style:
.: |
ha-card {
border-radius: 40px !important;
height:58px
}
cards:
- type: custom:mushroom-template-card
primary: Lichten
icon: mdi:ceiling-light-multiple
fill_container: true
multiline_secondary: true
entity: group.all_light_entities
tap_action:
action: navigate
navigation_path: /vermeulenhome-nieuw/lichten
layout: horizontal
card_mod:
style:
mushroom-state-info$: |
.container {
flex-direction: row !important;
justify-content: space-between;
align-items: center;
}
- type: custom:mushroom-template-card
icon: mdi:lightning-bolt
entity: group.all_light_entities
primary: >-
{{expand('group.all_light_entities')|selectattr('state','eq','on')|map(attribute='entity_id')|list|count}}
lichten aan
icon_color: >
{% if
expand('group.all_light_entities')|selectattr('state','eq','on')|map(attribute='entity_id')|list|count
== 0 %}
{% else %}
#ebcb8b
{% endif %}
card_mod:
style:
mushroom-shape-icon$: |
.shape {
--shape-color: none !important;
--icon-symbol-size: 16px;
--icon-size: 12px;
padding-right: 0px;
padding-left: 0px;
padding-bottom: 0px;
padding-top: 0px;
}
mushroom-state-info$: |
.container {
--card-secondary-font-size: 10px;
--card-primary-font-size: 11px;
}
.: |
ha-card {
position: absolute;
right: 10px;
top: 10px;
/*z-index: 0;*/
/* background-color: #002f7a !important;*/
background-color: rgba(235, 203, 139,0.3) !important;
border-radius: 30px !important;
height: 38px !important;
}
- type: custom:mushroom-template-card
icon: mdi:lightning-bolt
entity: group.all_light_entities
primary: "{{ states(\"sensor.wattage_alle_lichten_power\")}} Watt"
icon_color: >
{% if
expand('group.all_light_entities')|selectattr('state','eq','on')|map(attribute='entity_id')|list|count
== 0 %}
{% else %}
#ebcb8b
{% endif %}
card_mod:
style:
mushroom-shape-icon$: |
.shape {
--shape-color: none !important;
--icon-symbol-size: 16px;
--icon-size: 12px;
padding-right: 0px;
padding-left: 0px;
padding-bottom: 0px;
padding-top: 0px;
}
mushroom-state-info$: |
.container {
--card-secondary-font-size: 10px;
--card-primary-font-size: 11px;
}
.: |
ha-card {
position: absolute;
right: 127px;
top: 10px;
/*z-index: 0;*/
/* comment */
/* background-color: #002f7a !important;*/
background-color: rgba(235, 203, 139,0.3) !important;
border-radius: 30px !important;
height: 38px !important;
Thanks for reading and sharing any tips/advice/solutions you might have!
Kind regards,
Ben


