-
Notifications
You must be signed in to change notification settings - Fork 240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Styles Card Height 100% not working #861
Comments
- type: grid
square: true
columns: 3
cards:
- &test_btn
type: custom:button-card
show_name: true
show_icon: true
aspect_ratio: 1/1
entity: binary_sensor.developer
name: Status
show_state: false
styles:
card:
- height: 100%
state:
- value: 'on'
icon: mdi:check-circle
styles:
icon:
- color: green
- value: 'off'
icon: mdi:cancel
styles:
icon:
- color: red
- *test_btn |
Post your config code here, I'll try to help you if I can. |
Hey @ngocjohn This is the config:
|
@mateuszdrab button-card is the whole grid, you can modify styles for grid-template.. https://css-tricks.com/snippets/css/complete-guide-grid/ styles:
grid:
- grid-gap: 1rem
- padding: 1rem |
Thanks, this is much better. There are two small issues though:
|
Because they are not the same type of card, you have a different font size in styles than the other one, then of course it doesn't look good.... button-card is custom. I've just shown you other ways to work with the card. You have to edit it yourself, that's why many people have only one base universal button template. Which has common parameters and you insert entities or variables. One little tip, don't use too much card mod with custom button card. It's a custom itself, which can be used to do a lot of magic... Check out my config in my repo, you might get inspired. 😃 |
well.... I did, and got inspired by this:https://github.com/ngocjohn/hass-config/blob/c219b7081ef10313d1b14cea47daea336bd81045/config/dashboards/templates/button_card_templates/tpl_chips.yaml#L58C22-L58C69 can I reach out to you somewhere to have side chat? maybe in my community topic on using media aspects for an animation here? Thanks if you could have a look |
Thanks! Works like a charm :-) |
I've also run into this issue. This used to work:
As of 2024.7.x, height as a percentage in custom card mod no longer works. Thank you @StevenBrs for reporting this. I also don't want to assign a fixed height or aspect ratio. How parts of my dashboard look now: |
Again like the example above, create a base template for a button for example called square_button with modified css for the grid and apply with different entities. - type: custom:button-card
entity: light.ceiling_lights
template:
- square_button
- type: custom:button-card
entity: fan.ceiling_fan
template:
- square_button
- type: custom:button-card
entity: switch.ceiling_switch
template:
- square_button |
I appreciate the help with the workaround, but that does not address the issue of height % not working anymore. |
I just discovered something alike: using a button-card-template :
works for me in the normal cards section of a view. I use those for my camera streams. however, using the same buttons in the badge section of the new Ha 2024.8 (which allows us to use custom cards as badges, the size no longer functions, nor does the aspect_ratio for that matter. As a matter of fact, the only thing that changes the button is using the height and width on the card styles.... leaving out the template as those properties are not functional anyway. but alas, the stream of the video doesn't follow along: its weird to see this happen, and I am not yet convinced this is a button-card issue, and fear it is caused by the way the new badges are implemented. Cant correct it yet either using card-mod, or any of the built-in styling features of button-card. given this is an issue specific to the badges section for me, I believe I should hop over to the dedicated thread in the community, but just letting you know here as a FYI. |
I ran into this same problem too. I was able to solve it locally by adding the following to the _cardHtml() method in the button-card.ts file, recompiling, and copying the locally built version to my HACS files. Hacky, but it got my cards working with
This worked fine in the couple dashboards I use button-card in but YMMV. Seems likely it could conflict with other usages of the card since it's setting a style on the top level container. But I'm happy to submit a PR if the maintainers would like. |
Checklist
—> IOS companion app
Describe the bug
Since update to HA 2024.7.4 the card height property 100% isn’t working anymore inside a grid.
Version of the card
Version: v4.1.2
To Reproduce
This is the configuration I used:
Screenshots
Expected behavior
Smartphone (please complete the following information):
Additional context
The text was updated successfully, but these errors were encountered: