Fun with custom:button-card

After a lot of trial and error using different templates and themes, this template is the best that suits my needs. Simple layout, easy to find devices by grouping them and customizable. I love this.

I only have one question/issue. I also use other cards (eg. entities card) inside the container template. It works fine in the browser (PC), however in a smaller tablet (using companion app), the card inside the container does not resize. Is there a parameter for the non custom button cards inside the container to resize? In the image below, the Aircon climate card is truncated on both sides. The entities card on the right (under zones) is truncated on the right.

I also combined this with layout card and transparent theme.

Thank you @Ceddy, for pointing me towards styles on the custom button card.

I haven’t ended up using value instead, I’ve done it this way

type: vertical-stack
cards:
  - type: vertical-stack
    cards:
      - type: custom:button-card
        color_type: label-card
        color: rgb(150, 20, 246)
        name: Musty
  - type: horizontal-stack
    cards:
      - type: custom:button-card
        entity: sensor.fordpass_elveh
        show_state: true
        name: Range
        styles:
          grid:
            - grid-template-areas: '"i" "n" "s"'
          icon:
            - color: black
          name:
            - color: black
          state:
            - color: black
          card:
            - background-color: |
                [[[ 
                  if (entity.state <= 20) return 'red'
                  if (entity.state <= 50) return 'orange'
                  if (entity.state <= 150) return 'yellow'
                  else return 'green';
                  ]]]
                  
      - type: custom:button-card
        entity: sensor.musty_battery_precentage
        show_state: true
        name: Battery
        styles:
          grid:
            - grid-template-areas: '"i" "n" "s"'
          icon:
            - color: black
          name:
            - color: black
          state:
            - color: black
          card:
            - background-color: |
                [[[ 
                  if (entity.state <= 25) return 'red'
                  if (entity.state <= 50) return 'orange'
                  if (entity.state <= 75) return 'yellow'
                  else return 'green';
                  ]]]
                  
      - type: custom:button-card
        entity: sensor.fordpass_odometer
        icon: mdi:counter
        name: Millage
        show_name: true
        show_state: true
        icon_state: true
        styles:
          card:
            - background-color: royalblue
          icon:
            - color: black
          name:
            - color: black
          state:
            - color: black
  - type: conditional
    conditions:
      - entity: sensor.fordpass_deepsleepinprogress
        state_not: 'False'
    card:
      type: custom:button-card
      entity: sensor.fordpass_deepsleepinprogress
      name: Ssssh Musty is in a deep sleep
      icon: mdi:sleep
      styles:
        icon:
          - color: black
        name:
          - color: black
        state:
          - color: black
        card:
          - background-color: Green

Which in turn produces a look like this

2 Likes

Hi, I’m new - and need help. I’ve resisted posted, trying to learn…but I’ve spent so much time sifting through info and I just need a “reset” and help…

I’d like to be able to adjust the size of the icon in the code below, but just can’t figure out where to put the icon size properties. I also would love to know what the format is for custom button cards - having trouble with that. here’s my code below. Thanks in advance!!

type: custom:button-card
show_name: true
show_state: true
entity: light.bedroom_lamp_kasa
name: Lamp
state:
  - value: unavailable
    icon: mdi:lamp-outline
    color: red
  - value: 'on'
    icon: mdi:lamp-outline
    color: orange
  - value: 'off'
    icon: mdi:lamp-outline
    color: gray
tap action:
  action: toggle
styles:
  card:
    - font: 10px roboto
    - height: 50px
    - width: 106px
    - border-radius: 10px
    - font-size: 10px
    - padding-bottom: 8px
    - padding-top: 8px

[...]
tap action:
  action: toggle
styles:
  card:
    - font: 10px roboto
    - height: 50px
    - width: 106px
    - border-radius: 10px
    - font-size: 10px
    - padding-bottom: 8px
    - padding-top: 8px
  icon:
    - whatever: 0px

Docu link

The code here is YAML, like everywhere in HA. Button-card just makes one exception compared to HA standard: template code isn’t handled with Jinja2 (HA), it’s pure Javascript (button-card).

1 Like

Is it possible to have just text in a button in place of an icon?

If so, how would I achieve that?

Sure, why not, i use it all the time, this replaces markdown card (and adds tons of possibilities):

type: custom:button-card
name: whatever you want
show_icon: false

if you want even less height then add:

styles:
  card: 
    - padding: 0px
    - height: 10px
  name:
    - .....

without “padding: 0px” you can’t set height smaller than around 30-40px.

I have developed the following person cards using button card.

image

I am thinking about making a change and wondering if there is a way to color the top half of the card (behind entity and location icon) based on the current state of each person entity? I have not been able to find a way to just color half of the card. Is this possible?

Forgive my crude drawing, but this is what I am thinking.

Here is my code as it stands now. Thanks in advance for any help.

person_complete:
  variables:
    state_on: >
      [[[ return ['home'].indexOf(!entity || entity.state) !== -1; ]]]
    state: >
      [[[ return !entity || entity.state; ]]]
    entity_id: >
      [[[ return !entity || entity.entity_id; ]]]
    entity_picture: >
      [[[ return !entity || entity.attributes.entity_picture; ]]]
    translate_home: Home
    translate_not_home: Away
  aspect_ratio: 1/1
  show_state: false
  show_label: false
  show_icon: false
  state_display: >
    [[[
      if (entity) {
          return variables.state === 'home'
              ? variables.translate_home
              : variables.state === 'not_home'
                  ? variables.translate_not_home
                  : variables.state;
      }
      return variables.translate_unknown;
    ]]]
  tap_action:
    action: more-info
  styles:
    grid:
      - grid-template-areas: |
          "icon  circle"
          "n     n"
          "s     s"
      - grid-template-columns: repeat(2, 1fr)
      - grid-template-rows: auto repeat(3, min-content)
      - gap: 1.3%
      - align-items: start
      - will-change: transform
    name:
      - justify-self: start
      - line-height: 110%
      - font-size: 15px
      - font-weight: bold
    state:
      - justify-self: start
      - line-height: 110%
      - font-size: 12px
    card:
      - --c-color-home: '#32a852'
      - --c-color-away: rgb(255,0,0)
      - --c-color-zone: '#ffbf00'
      - --c-color-stationary: '#3182b7'
      - --c-stroke-width: 2.3
      - --c-icon-color-on: rgb(0,0,0)
      - --c-icon-color-off: '#97989c'
      - border-radius: 10px
      - border-width: 0px
      - -webkit-tap-highlight-color: rgba(0,0,0,0)
      - transition: none
      - --mdc-ripple-color: >
          [[[
            return variables.state_on
                ? 'rgb(0,0,0)'
                : '#97989c';
          ]]]
      - color: >
          [[[
            return variables.state_on
                ? 'rgb(0,0,0)'
                : '#97989c';
          ]]]
      - background-color: >
          [[[
            return variables.state_on
                ? 'rgba(255,255,255, 0.85)'
                : 'rgba(115, 115, 115, 0.25)';
          ]]]
    custom_fields:
      icon:
        - clip-path: circle()
        - width: 85%
        - pointer-events: none
        - display: grid
      circle:
        - display: initial
        - width: 88%
        - margin: -3% 2% 0 0
        - justify-self: end
        - opacity: 1
  custom_fields:
    icon: >
      [[[
        return entity && variables.entity_picture
            ? `<img src="${variables.entity_picture}" width="100%">`
            : null;
      ]]]
    circle: >
      [[[
        if (variables.state === 'home') {
          let input = entity.state,
            r = 18,
            c = r * 2 * Math.PI,
            dasharray = c,
            dashoffset = c - input / 100 * c;
          return `
            <svg viewBox="0 0 50 50">
              <circle cx="25" cy="25" r="${r}" stroke='var(--c-color-home)' stroke-dashoffset="${dashoffset}" stroke-dasharray="${dasharray}" stroke-width='var(--c-stroke-width)' fill='var(--c-color-home)' style="transform: rotate(-90deg); transform-origin: 50% 50%;" />
              <path d="M23 33.5V27.5H27V33.5H32V25.5H35L25 16.5 15 25.5H18V33.5H23Z" fill='var(--c-icon-color-on)'/>
            </svg>
          `;
        }
        if (variables.state === 'BHS') {
          let input = entity.state,
            r = 18,
            c = r * 2 * Math.PI,
            dasharray = c,
            dashoffset = c - input / 100 * c;
          return `
            <svg viewBox="0 0 50 50">
              <circle cx="25" cy="25" r="${r}" stroke='var(--c-color-zone)' stroke-dashoffset="${dashoffset}" stroke-dasharray="${dasharray}" stroke-width='var(--c-stroke-width)' fill='var(--c-color-zone)' style="transform: rotate(-90deg); transform-origin: 50% 50%;" />
              <path d="M25 16 14 22 25 28 34 23.09V30H36V22M18 26.18V30.18L25 34 32 30.18V26.18L25 30 18 26.18Z" fill='var(--c-icon-color-off)'/>
            </svg>
          `;
        } 
        if (variables.state === 'CCAC') {
          let input = entity.state,
            r = 18,
            c = r * 2 * Math.PI,
            dasharray = c,
            dashoffset = c - input / 100 * c;
          return `
            <svg viewBox="0 0 50 50">
              <circle cx="25" cy="25" r="${r}" stroke='var(--c-color-zone)' stroke-dashoffset="${dashoffset}" stroke-dasharray="${dasharray}" stroke-width='var(--c-stroke-width)' fill='var(--c-color-zone)' style="transform: rotate(-90deg); transform-origin: 50% 50%;" />
              <path d="M25 16 14 22 25 28 34 23.09V30H36V22M18 26.18V30.18L25 34 32 30.18V26.18L25 30 18 26.18Z" fill='var(--c-icon-color-off)'/>
            </svg>
          `;
        }
        if (variables.state === 'Lowes') {
          let input = entity.state,
            r = 18,
            c = r * 2 * Math.PI,
            dasharray = c,
            dashoffset = c - input / 100 * c;
          return `
            <svg viewBox="0 0 50 50">
              <circle cx="25" cy="25" r="${r}" stroke='var(--c-color-zone)' stroke-dashoffset="${dashoffset}" stroke-dasharray="${dasharray}" stroke-width='var(--c-stroke-width)' fill='var(--c-color-zone)' style="transform: rotate(-90deg); transform-origin: 50% 50%;" />
              <path d="M23 15.5H27A2 2 0 0 1 29 17.5V19.5H33A2 2 0 0 1 35 21.5V32.5A2 2 0 0 1 33 34.5H17C15.89 34.5 15 33.6 15 32.5V21.5C15 20.39 15.89 19.5 17 19.5H21V17.5C21 16.39 21.89 15.5 23 15.5M27 19.5V17.5H23V19.5H27Z" fill='var(--c-icon-color-off)'/>
            </svg>
          `;
        }
        if (variables.state === 'Stantec') {
          let input = entity.state,
            r = 18,
            c = r * 2 * Math.PI,
            dasharray = c,
            dashoffset = c - input / 100 * c;
          return `
            <svg viewBox="0 0 50 50">
              <circle cx="25" cy="25" r="${r}" stroke='var(--c-color-zone)' stroke-dashoffset="${dashoffset}" stroke-dasharray="${dasharray}" stroke-width='var(--c-stroke-width)' fill='var(--c-color-zone)' style="transform: rotate(-90deg); transform-origin: 50% 50%;" />
              <path d="M23 15.5H27A2 2 0 0 1 29 17.5V19.5H33A2 2 0 0 1 35 21.5V32.5A2 2 0 0 1 33 34.5H17C15.89 34.5 15 33.6 15 32.5V21.5C15 20.39 15.89 19.5 17 19.5H21V17.5C21 16.39 21.89 15.5 23 15.5M27 19.5V17.5H23V19.5H27Z" fill='var(--c-icon-color-off)'/>
            </svg>
          `;
        }
        if (variables.state === 'Vernon') {
          let input = entity.state,
            r = 18,
            c = r * 2 * Math.PI,
            dasharray = c,
            dashoffset = c - input / 100 * c;
          return `
            <svg viewBox="0 0 50 50">
              <circle cx="25" cy="25" r="${r}" stroke='var(--c-color-zone)' stroke-dashoffset="${dashoffset}" stroke-dasharray="${dasharray}" stroke-width='var(--c-stroke-width)' fill='var(--c-color-zone)' style="transform: rotate(-90deg); transform-origin: 50% 50%;" />
              <path d="M20.5 15A2 2 0 0 1 22.5 17 2 2 0 0 1 20.5 19 2 2 0 0 1 18.5 17 2 2 0 0 1 20.5 15M19 35V29H16L18.6 21.4C18.9 20.6 19.6 20 20.5 20 21.4 20 22.2 20.6 22.4 21.4L25 29 27.6 21.4C27.9 20.6 28.6 20 29.5 20 30.4 20 31.2 20.6 31.4 21.4L34 29H31V35H28V29H25L22 29V35H19M29.5 15A2 2 0 0 1 31.5 17 2 2 0 0 1 29.5 19 2 2 0 0 1 27.5 17 2 2 0 0 1 29.5 15Z" fill='var(--c-icon-color-off)'/>
            </svg>
          `;
        } else {
          let input = entity.state,
            r = 18,
            c = r * 2 * Math.PI,
            dasharray = c,
            dashoffset = c - input / 100 * c;
          return `
            <svg viewBox="0 0 50 50">
              <circle cx="25" cy="25" r="${r}" stroke='var(--c-color-away)' stroke-dashoffset="${dashoffset}" stroke-dasharray="${dasharray}" stroke-width='var(--c-stroke-width)' fill='var(--c-color-away)' style="transform: rotate(-90deg); transform-origin: 50% 50%;" />
              <path d="M36.5 26.5 32.5 30.5V27.5H23.5V25.5H32.5V22.5L36.5 26.5M16.5 33.5V25.5H13.5L23.5 16.5 30.5 22.8V23.5H28.29L23.5 19.19 18.5 23.69V31.5H28.5V29.5H30.5V33.5H16.5Z" fill='var(--c-icon-color-off)'/>
            </svg>
          `;
        } 
      ]]]
  extra_styles: >
    [[[
      if (entity) {
          if (entity.entity_id.split('.')[0] === 'light' && variables.state_on) {

              // theme variable and conditions
              let style = getComputedStyle(document.body),
                  theme_var = style.getPropertyValue('--button-card-light-color-temp'),
                  is_hsl = theme_var.startsWith('hsl('),
                  is_color_temp = entity.attributes.color_mode === 'color_temp';

              if (is_hsl && is_color_temp && entity.attributes.brightness) {

                  // calculate lightness in hsl
                  let regex_pattern = /(\d+)(?!.*\d)/g,
                      brightness = entity.attributes.brightness / 2.54,
                      lightness = parseFloat(theme_var.match(regex_pattern)[0]),
                      min = lightness - 10,
                      max = lightness + 10,
                      calc_lightness = brightness * (max - min) / 100 + min;

                  var light_color = theme_var.replace(regex_pattern, calc_lightness);
              }
              else {
                  var light_color = 'var(--button-card-light-color)';
              }
          }
      }
      return `

       /* * * * * * * * * * * * * * * * * *
        *                                 *
        *              LIGHT              *
        *                                 *
        * * * * * * * * * * * * * * * * * */

        svg {
          --light-color: ${
            variables.state_on && entity.attributes.brightness
                ? light_color
                : variables.state_on && !entity.attributes.brightness
                    ? 'var(--state-icon-active-color);'
                    : 'var(--state-icon-color);' }
        }

        .light-color {
          fill: var(--light-color);
          transition: all 0.25s ease-out;
        }

        /* magnification */
        :host {
          --card-portrait: 1.4;
          --card-phone: 2.271;
        }

        ${this._config.template.includes('light') ? `

         /* * * * * * * * * * * * * * * * * *
          *                                 *
          *          CIRCLE SLIDER          *
          *                                 *
          * * * * * * * * * * * * * * * * * */

          #circle_slider {
            opacity: 0;
            appearance: none;
            transform: rotate(270deg);
            width: 90%;
            position: absolute;
            pointer-events: none;
            cursor: grab;
            left: 26%;
            margin-top: 13%;
          }

          #circle_slider::-webkit-slider-thumb {
            pointer-events: initial;
            appearance: none;
            width: 3vw;
            height: 3vw;
            border-radius: 50%;
            background: green;
          }

          #circle_slider::-webkit-slider-runnable-track {
            background: cornflowerblue;
          }

          #circle_slider::-moz-range-thumb {
            pointer-events: initial;
            appearance: none;
            width: 3vw;
            height: 3vw;
            border-radius: 50%;
            background: green;
          }

          #circle_slider::-moz-range-track {
            background: cornflowerblue;
            height: 3vw;
          }

          /* portrait */
          @media screen and (max-width: 1200px) {
            #circle_slider::-webkit-slider-thumb {
              width: 4vw;
              height: 4vw;
            }

            #circle_slider::-moz-range-thumb {
              width: 4vw;
              height: 4vw;
            }
          }

          /* phone */
          @media screen and (max-width: 800px) {
            #circle_slider::-webkit-slider-thumb {
              width: 5.8vw;
              height: 5.8vw;
            }

            #circle_slider::-moz-range-thumb {
              width: 5.8vw;
              height: 5.8vw;
            }
          }

        `:''}

       /* * * * * * * * * * * * * * * * * *
        *                                 *
        *              BASE               *
        *                                 *
        * * * * * * * * * * * * * * * * * */

        #container {
          text-align: left !important;
          z-index: 1;
        }

        #card {
          padding: 10.9% 9.9% 9.9% 10.9%;
        }

        #state::first-letter {
          text-transform: uppercase;
        }

        #name, #state {
          font-size: var(--button-card-font-size);
          font-weight: var(--button-card-font-weight);
          letter-spacing: var(--button-card-letter-spacing);
        }

      `;
    ]]]
1 Like

Hi,

I have troubles with templates. I want a vpn icon on off if vpn is connected.
the sensor is sensor.hushush_vpn_ip and the regex match is “(\d+).(\d+).(\d+).(\d+)”

I cant find it out.

type: custom:button-card
variables:
  my_entity: sensor.hushush_vpn_ip
  
entity_picture: '[[[ if (my_entity.match("(\d+)\.(\d+)\.(\d+)\.(\d+)")   return `/local/images/vpn.png`; else return return `/local/images/vpn-off.png`; ]]]'
tap_action:
  action: navigate
  navigation_path: /lovelace/vpn
show_entity_picture: true
name: VPN
show_state: false
size: 90px
use_light_color: true
style:
  top: 40%
  left: 13%
  width: 24%

Good morning everyone, I have this button card that should blink me at every change of state other than zero, but instead it blinks me only when it goes from 0 to a new state, does the state include xx.xx numbers? Thanks to those who will help me

      type: custom:button-card
      entity: sensor.bilancia_xiaomi_vins
      show_units: false
      show_state: true
      show_icon: false
      show_name: false
      styles:
        card:
          - border-width: 0px
          - font-size: 35px
        state:
          - animation: |
              [[[
                if (states['sensor.bilancia_xiaomi_vins'].state >= 0)                      
                  return "blink 2s";
              ]]] 
      card_mod:
        style: |
          ha-card {
            color: white;
            text-align: center;
            font-family: digital;
            text-shadow: 1px 1px 0px white,  0 0 0.2em white;
            letter-spacing: normal;

          }

new issue.

this botton cant get the color of the kitchen light.

type: custom:button-card
icon: mdi:sofa
tap_action:
  action: navigate
  navigation_path: /lovelace/woonkamer-panel
name: Huiskamer panel
color:  '[[[ return `rgb(${states["light.keuken"].attributes.rgb_color[0]},${states["light.keuken"].attributes.rgb_color[1]},${states["light.keuken"].attributes.rgb_color[2]})` ]]]'
size: 90px

Thanks to this thread, I’ve started building my frontend to be more button friendly.

1 Like

Does somebody know how i can align the button-cards with the markdowncard ?

This is the code from the raw editor

kiosk_mode:
  non_admin_settings:
    kiosk: true
    ignore_entity_settings: true
views:
  - title: Home
    path: login
    theme: clear-dark
    type: custom:grid-layout
    layout_type: custom:grid-layout
    layout:
      gridrows: auto
      grid-template-columns: 40% 10% 1fr
      grid-template-areas: |
        "a1 a2 a3 a4"
        "b1 b2 b3 b4"
        "c1 c2 c3 c4"
      subview: false
    subview: false
    icon: mdi:home
    badges: []
    cards:
      - type: markdown
        content: |-
          <font size="10">{{ states('sensor.today_time') }}</font>

          <font size="5">{{ states('sensor.today_day') }}</font>
        theme: clear-dark
        view_layout:
          grid-area: a1
      - square: false
        type: grid
        cards:
          - type: custom:button-card
            color_type: card
            name: Home
            styles:
              card:
                - background: transparent
                - color: white
                - height: 70px
                - width: 200px
            border-radius: 50%
            tap_action:
              action: navigate
              navigation_path: /lovelace/zonnepanelen
          - type: custom:button-card
            color_type: card
            name: Beveiliging
            styles:
              card:
                - background: transparent
                - color: white
                - height: 70px
                - width: 200px
            border-radius: 50%
            tap_action:
              action: navigate
              navigation_path: /lovelace/zonnepanelen
          - type: custom:button-card
            color_type: card
            name: Zonnepanelen
            styles:
              card:
                - background: transparent
                - color: white
                - height: 70px
                - width: 200px
            border-radius: 50%
            tap_action:
              action: navigate
              navigation_path: /lovelace/zonnepanelen
          - type: custom:button-card
            color_type: card
            name: Verwarming
            styles:
              card:
                - background: transparent
                - color: white
                - height: 70px
                - width: 200px
            border-radius: 50%
            tap_action:
              action: navigate
              navigation_path: /lovelace/zonnepanelen
          - type: custom:button-card
            color_type: card
            name: Instellingen
            styles:
              card:
                - background: transparent
                - color: white
                - height: 70px
                - width: 200px
            border-radius: 50%
            tap_action:
              action: navigate
              navigation_path: /lovelace/zonnepanelen
          - type: custom:button-card
            color_type: card
            name: Camera's
            styles:
              card:
                - background: transparent
                - color: white
                - height: 70px
                - width: 200px
            border-radius: 50%
            tap_action:
              action: navigate
              navigation_path: /lovelace/zonnepanelen
          - type: custom:button-card
            color_type: card
            name: Weer
            styles:
              card:
                - background: transparent
                - color: white
                - height: 70px
                - width: 200px
            border-radius: 50%
            tap_action:
              action: navigate
              navigation_path: /lovelace/zonnepanelen
          - type: custom:button-card
            color_type: card
            name: Verlichting
            styles:
              card:
                - background: transparent
                - color: white
                - height: 70px
                - width: 200px
            border-radius: 50%
            tap_action:
              action: navigate
              navigation_path: /lovelace/zonnepanelen
        columns: 4
        view_layout:
          grid-area: b1

ok, very basic question but I seem to have a black out… how do I properly write this, so that I get the state of that sensor displayed??

  label: >
    [[[
      return `<span>${state.sensor.time_of_day_sv}</span>`
    ]]]

Hi guys,
in this code:

extra_styles: |
  @keyframes music {
    0% {  box-shadow: 0 0 5px -2px rgba(255,0,255, 100%)}
    90% { box-shadow: 0 0 5px 12px rgba(255,0,255, 0)}
   }

how can I replace the rgb value with the rgb attribute of a light bulb?
I can do it in card style but not in the keyframe
for example, this is the working code for the icon color:

styles:

  icon:
    - height: 28px
    - width: 28px
    - color: >-
        [[[ return "rgba(" + states['light.virtual_light_1'].attributes.rgb_color +",1)"]]]

Thanks in advance

  label: >
    [[[
      return `<span>${states[sensor.time_of_day_sv].state}</span>`;
    ]]]
1 Like

why use the span? simply do:

  label: >
    [[[
      return states['sensor.time_of_day_sv'].state;
    ]]]
1 Like

Can anyone help me with a multi line state display, using custom:button-card please? I’m ‘simply’ trying to display the day and date over 2 lines, as per the way my template sensor renders.

Template sensor:

    - name: "Date Formatted"
      state: "{{ as_timestamp(states('sensor.date_time_iso')) | timestamp_custom('%A\n%-d %B') }}"
      icon: "mdi:calendar-clock"

and in the template editor in Dev Tools, the resulting string renders correctly over 2 lines:
image

however in the custom:button-card, the string appears all on one line:

type: custom:button-card
entity: sensor.date_formatted
show_name: false
show_icon: false
show_state: true
tap_action:
  action: none
styles:
  card:
    - padding-top: 10px
    - text-align: center
    - border-width: 0
    - font-family: SF Pro Display, Roboto, system-ui
  state:
    - font-size: var(--sidebar-date-font-size)
    - font-weight: 300
    - line-height: var(--sidebar-time-line-height)
    - color: rgba(255, 255, 255, 0.8)
    - display: flex
    - flex-direction: column
    - align-items: center

like this:

Can anyone help identify what is preventing the multi line display?

Hey there,

I’m facing an issue where I just want to add a “more-info” custom-fields button but I can see the border of the button itself. When I push on the button, I can see the custom card being yellow execpt the “custom-fields” button which is black inside, what can I do in that case ?

Cheers!

type: custom:button-card
entity: light.living_room_light_light
name: Living Room
state:
  - value: 'on'
    icon: mdi:lamp
    color: rgb(255, 255, 153)
  - operator: default
    icon: mdi:lamp-outline
show_icon: true
color_type: card
size: 50%
tape_action:
  action: toggle
hold_action:
  action: more-info
custom_fields:
  info:
    card:
      type: custom:button-card
      icon: mdi:information-box
      tap_action:
        action: more-info
        entity: light.living_room_light_light
styles:
  custom_fields:
    info:
      - border-radius: 50%
      - background-color: transparent
      - box-shadow: non
      - position: absolute
      - left: 65%
      - top: 5%
      - height: 20px
      - width: 80px
      - font-size: 8px
      - line-height: 20px

I tried “transparent” background but it doesn’t work in that case.

Can anyone help me with the formatting of

extra_styles: |
  [[[ { background-image: url("/local/buttons/button_basic_red.png");
  } ]]]

I have a 3d button I want to use as a background image and cant seem to get it to display and there are no examples in this thread that dont use the @keyframes

Many thanks

Add a background image:


    - background-image: |
        [[[
          return variables.state_on
              ? 'linear-gradient(to bottom, rgba(255,0,0,.5) 0%, rgba(255,0,0,.5) 50%, rgba(0,0,0,0) 50%)'
              : 'rgba(115, 115, 115, 0.25)';
        ]]]