Lovelace - horizontal-stack not working

I just started working with the Lovelace interface today (writing my own yaml files). I was able to get the back setup working but now wanted to change the cards from vertical to horizontal stacking. When I add that command, the cards do not change and stay vertical. Any ideas why?

title: My Home
# Include external resources
resources:
  # https://github.com/custom-cards/button-card
  - url: /local/button-card.js
    type: module
  # https://github.com/custom-components/custom_updater
  - url: /customcards/github/custom-cards/button-card.js?track=true
    type: module

# Optional background for all views. Check https://developer.mozilla.org/en-US/docs/Web/CSS/background for more examples.
#background: center / cover no-repeat url("/background.png") fixed
# Exclude entities from "Unused entities" view
#excluded_entities:
#  - weblink.router
views:
    # View tab title.
  - title: Example
    # Unique path for direct access /lovelace/${path}
    path: example
    # Cards
    cards:
      - type: "custom:button-card"
        entity: switch.den_table_lamp_tv
        name: TV Lamp
        #icon: midi:sofa
        #color_type: card
        color: auto

    # Title of the view. Will be used as the tooltip for tab icon
  - type: horizontal-stack
    title: Den
    path: Den
    icon: mdi:home-assistant
    cards:
      - type: "custom:button-card"
        entity: switch.den_table_lamp_stairs
        name: Stairs Lamp
        #icon: midi:sofa
        color_type: card
        color: auto
        styles:
          card:
            - height: 110px
            - width: 110px

      - type: "custom:button-card"
        entity: switch.den_table_lamp_tv
        #name: TV Lamp
        #icon: midi:sofa
        #color_type: card
        color: auto
        size: 25%

  - type: horizontal-stack
    title: Outside
    path: Outside
    icon: mdi:home-assistant
    cards:
      - type: "custom:button-card"
        entity: binary_sensor.backdoor_sensor
        name: Back Door
        #icon: midi:sofa
        color_type: card
        color: auto
        styles:
          card:
            - height: 110px
            - width: 110px

      - type: "custom:button-card"
        entity: switch.front_door_light
        #label_template: >
        #  var bri = states['light.test_light'].attributes.brightness; 
        #  return 'Brightness: ' + (bri ? bri : '0') + '%';
        #name: Stairs Lamp
        #icon: midi:sofa
        color_type: card
        color: auto
        styles:
          card:
            - height: 110px
            - width: 110px

Dude if you want any help you will need to format you code first can’t do much with what you have provided above.

I’m trying to do that… how to you include code?

highlight your code and select the </> from the menu

Thanks for the assistance

You have to horizontal stacks in the same panel, one is enough.

There are multiple tabs so I have a horizontal-stack for each of the 2nd and 3rd tabs (i.e. views).

Even so, should it not show the cards horizontally? Currently they are stacked vertically

Do you have 3 tabs now? Can you show a picture how it looks like currently? I will need to check your config when I’m home again.

Here is how it looks now…

Ok… I made a few changes to my config and sorta have the cards arranged horizontally. What I don’t understand is why it shows 2 cards per line

Here is my revised config:

title: My Home
# Include external resources
resources:
  # https://github.com/custom-cards/button-card
  - url: /local/button-card.js
    type: module
  # https://github.com/custom-components/custom_updater
  - url: /customcards/github/custom-cards/button-card.js?track=true
    type: module

# Optional background for all views. Check https://developer.mozilla.org/en-US/docs/Web/CSS/background for more examples.
#background: center / cover no-repeat url("/background.png") fixed
# Exclude entities from "Unused entities" view
#excluded_entities:
#  - weblink.router
views:
    # View tab title.
  - title: Home
    # Unique path for direct access /lovelace/${path}
    path: home
    icon: mdi:home
    # Cards
    cards:
      - type: "custom:button-card"
        entity: switch.den_table_lamp_tv
        name: TV Lamp
        #icon: midi:sofa
        #color_type: card
        color: auto

    # Title of the view. Will be used as the tooltip for tab icon
  - type: horizontal-stack
    title: Lights
    path: lights
    icon: mdi:home-assistant
    cards:
      - type: "custom:button-card"
        entity: switch.den_table_lamp_stairs
        name: Stairs Lamp
        #icon: midi:sofa
        color: auto
        styles:
          card:
            - height: 110px
            - width: 110px

      - type: "custom:button-card"
        entity: switch.den_table_lamp_tv
        #name: TV Lamp
        #icon: midi:sofa
        #color_type: card
        color: auto
        #size: 25%
        styles:
          card:
            - height: 110px
            - width: 110px

      - type: "custom:button-card"
        entity: switch.front_door_light
        #label_template: >
        #  var bri = states['light.test_light'].attributes.brightness; 
        #  return 'Brightness: ' + (bri ? bri : '0') + '%';
        #name: Stairs Lamp
        #icon: midi:sofa
        color: auto
        styles:
          card:
            - height: 110px
            - width: 110px

      - type: "custom:button-card"
        entity: switch.back_door_lights
        color: auto
        styles:
          card:
            - height: 110px
            - width: 110px

      - type: "custom:button-card"
        entity: binary_sensor.backdoor_sensor
        name: Back Door Motion
        #icon: midi:sofa
        color: auto
        styles:
          card:
            - height: 110px
            - width: 110px

You need to put the horizontal stack one level deeper. Currently you are defining the view as horizontal stack but instead the first card of the view should be the horizontal stack.

Try this:

  - title: Lights
    icon: mdi:home-assistant
    path: lights
    panel: true
    cards:
      - type: horizontal-stack
        cards:
          - type: "custom:button-card"
            entity: switch.den_table_lamp_stairs
            name: Stairs Lamp
            #icon: midi:sofa
            color: auto
            styles:
              card:
                - height: 110px
                - width: 110px

          - type: "custom:button-card"
            entity: switch.den_table_lamp_tv
            #name: TV Lamp
            #icon: midi:sofa
            #color_type: card
            color: auto
            #size: 25%
            styles:
              card:
                - height: 110px
                - width: 110px

          - type: "custom:button-card"
            entity: switch.front_door_light
            #label_template: >
            #  var bri = states['light.test_light'].attributes.brightness; 
            #  return 'Brightness: ' + (bri ? bri : '0') + '%';
            #name: Stairs Lamp
            #icon: midi:sofa
            color: auto
            styles:
              card:
                - height: 110px
                - width: 110px

          - type: "custom:button-card"
            entity: switch.back_door_lights
            color: auto
            styles:
              card:
                - height: 110px
                - width: 110px

          - type: "custom:button-card"
            entity: binary_sensor.backdoor_sensor
            name: Back Door Motion
            #icon: midi:sofa
            color: auto
            styles:
              card:
                - height: 110px
                - width: 110px

Ok, will do. Thanks.

Ok, I know have my cards aligned horizontally but not all of them are showing. How do I control the “window” of the cards?

  # Title of the view. Will be used as the tooltip for tab icon
  - title: Lights
    path: lights
    icon: mdi:lightbulb
    #panel: true
    cards:
      - type: horizontal-stack    
        cards:
          - type: "custom:button-card"
            entity: switch.den_table_lamp_stairs
            name: Stairs Lamp
            #icon: midi:sofa
            color: auto
            styles:
              card:
                - height: 110px
                - width: 110px

          - type: "custom:button-card"
            entity: switch.den_table_lamp_tv
            name: TV Lamp
            #icon: midi:sofa
            #color_type: card
            color: auto
            #size: 25%
            styles:
              card:
                - height: 110px
                - width: 110px

          - type: "custom:button-card"
            entity: switch.front_door_light
            #label_template: >
            #  var bri = states['light.test_light'].attributes.brightness; 
            #  return 'Brightness: ' + (bri ? bri : '0') + '%';
            name: Front Door
            #icon: midi:sofa
            color: auto
            styles:
              card:
                - height: 110px
                - width: 110px

          - type: "custom:button-card"
            entity: switch.back_door_lights
            name: Back Door
            color: auto
            styles:
              card:
                - height: 110px
                - width: 110px

          - type: "custom:button-card"
            entity: binary_sensor.backdoor_sensor
            name: Back Door Motion
            #icon: midi:sofa
            color: auto
            styles:
              card:
                - height: 110px
                - width: 110px

          - type: "custom:button-card"
            entity: switch.back_yard_lights
            name: Back Yard
            #icon: midi:sofa
            color: auto
            styles:
              card:
                - height: 110px
                - width: 110px

          - type: "custom:button-card"
            entity: switch.garage_light
            name: Garage
            #icon: midi:sofa
            color: auto
            styles:
              card:
                - height: 110px
                - width: 110px

          - type: "custom:button-card"
            entity: switch.master_bedroom_table_lamp
            name: Master Bedroom
            #icon: midi:sofa
            color: auto
            styles:
              card:
                - height: 110px
                - width: 110px