jcwillox / lovelace-paper-buttons-row

Adds highly configurable buttons that use actions and per-state styling.
MIT License
310 stars 10 forks source link

How to align row label? #185

Open magune opened 4 months ago

magune commented 4 months ago

I have spent several hours trying to get a number of rows, where each row starts with the room name and to the right there are some buttons to control scene in that room.

But I cannot figure out how to make the leftmost column having a fixed size with left-aligned text, to make all rows having the same layout:

image

Right now the code looks like this, but I have tried many versions that also didnt work:

          - type: entities
            entities:
              - type: "custom:paper-buttons-row"                    
                buttons:
                  - name: Hela lägenheten
                    icon: false
                    styles:
                      name:
                        justify-self: flex-start 
                  - entity: script.allmana_rum_mysbelysning
                    name: false
                    icon: mdi:lightbulb-on-10   

                  - entity: script.allmana_rum_mysbelysning
                    name: false                      
                    icon: mdi:lightbulb-on-50
                  - entity: script.allmana_rum_mysbelysning
                    name: false                      
                    icon: mdi:lightbulb-off-outline
              - type: "custom:paper-buttons-row"
                styles:
                  justify-content: flex-start                   
                buttons:
                  - entity: script.allmana_rum_mysbelysning
                    name: Sovrum
                    icon: false
  ....

I can get the text left aligned, or having the text at a fixed width, but not both at the same time.

Any suggestions would be most appreciated!

magune commented 4 months ago

This finally solved it:

image
         - type: entities
            entities:
              - type: "custom:paper-buttons-row"                      
                buttons:
                  - name: Hela lägenheten
                    icon: false
                    styles:
                      button:
                        text-align: left
                        width: 150px
                        justify-content: flex-start                                
                      name:
                        justify-content: flex-start 
                        text-align: left                            
                      icon:
                        --mdc-icon-size: 40px # make the icon bigger.                            
                  - entity: script.allmana_rum_mysbelysning
                    name: false
                    icon: mdi:lightbulb-on-10   
                    styles:                     
                      icon:
                        --mdc-icon-size: 32px # make the icon bigger.                            
                  - entity: script.allmana_rum_mysbelysning
                    name: false                      
                    icon: mdi:lightbulb-on-50
                  - entity: script.allmana_rum_mysbelysning
                    name: false                      
                    icon: mdi:lightbulb-off-outline
              - type: "custom:paper-buttons-row"
                buttons:
                  - entity: script.allmana_rum_mysbelysning
                    name: Sovrum
                    icon: false
                    styles:
                      button:
                        text-align: left
                        width: 150px
                        justify-content: flex-start                                
                      name:
                        justify-content: flex-start 
                        text-align: left                            
                      icon:
                        --mdc-icon-size: 40px # make the icon bigger.