somehow, Ive always used custom:button-card
to make the headers of my compound listing cards (entities, vertical-stack) when in need of some templated value in the header.
my regular headers are:
ha-card.class-header-margin .card-header {
background: var(--background-color-off);
font-weight: 400;
font-size: 20px;
color: var(--text-color-off);
padding: 0px 12px;
margin: 0px 0px 16px 0px;
}
in card-mod theme, and they are matched by this button-card template:
button_default_title:
show_state: false
show_icon: false
tap_action:
action: none
styles:
card:
- background: var(--background-color-off)
- color: var(--text-color-off)
- font-size: 20px
- font-weight: 400
- padding: 12px
name:
- justify-self: left
and make this possible:
- type: custom:button-card
template: button_default_title
name: >
[[[ return 'Kies Activiteit: ' + states['input_select.activiteit'].state; ]]]
only now (ā¦) it dawned on me, I could also use a markdown card for the templated content, so I copied the style, but it doesnāt exactly fit.
- type: markdown
content: >
Kies Activiteit: {{states('input_select.activiteit')}}
card_mod:
style: |
ha-card.type-markdown {
background: var(--background-color-off);
color: var(--text-color-off);
font-size: 20px;
font-weight: 400;
}
.no-header {
padding: 8px 12px 14px 12px;
}
itās almost there, but the margins are a bit peculiar. Ive set them on the .no-header now, at forst I had set them on the card, but apparently the markdown has its own stylings that interfere
as it stands its very nice, but not exact, and need a second eye to see where I should change the padding to make it perfect.
The top card is the button-card, with a perfectly centered name. the bottom one is the markdown, which slightly changes:
I could probably customize those paddings more meticulously, as I had to do with the new section heading
ha-card.class-section-heading .container {
background: var(--background-color-off);
--ha-heading-card-title-color: var(--text-color-off) !important;
--ha-heading-card-title-font-size: 20px !important;
--ha-heading-card-title-font-weight: 400;
height: 24px;
padding: 12px 8px 12px 12px;
}
but maybe I am targeting the wrong element in the Markdown ?
btw Iāve filed a FR for adding actions to Markdown please consider upvoting that