card_mod貌似对徽章不起作用呀
换成button card 吧
type: custom:button-card
entity: input_boolean.ceshi9
show_state: false
show_label: true
name: 名称
label: 这是label
icon: mdi:fan
tap_action:
action: toggle
extra_styles: |
@keyframes spin {
0% {transform: rotate(0deg);}
100% {transform: rotate(360deg);}
}
styles:
grid:
- grid-template-areas: |
"i l"
"i n"
- grid-template-columns: 24px 1fr
- grid-template-rows: 1fr 1fr
- column-gap: 8px
card:
- height: 36px
- border-radius: 18px
- padding: 0px 8px
name:
- font-size: 12px
- font-weight: bold
- justify-self: flex-start
- align-self: start
label:
- font-size: 10px
- justify-self: flex-start
- align-self: end
icon:
- width: 18px
- color: green
- animation: |
[[[return entity && entity.state == "on" ? "spin 1s linear infinite" : "" ]]]
|