-
Notifications
You must be signed in to change notification settings - Fork 243
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
Section Support #854
Comments
@aLAN-LDZ could you share your solution please? I am having the same issue on 1x1, because of card size: |
use the horizontal stack as the base card and place the button card in it |
yes I agree, I only provided a temporary solution |
You can use the extra_styles: |
:host,ha-card{height:100%!important}
#container{height:inherit!important}
#img-cell+*{margin-top:8px} (Edited to update YAML to give identical rendering to regular button cards) |
I was able to solve it, with dynamic section support, by adding a height style value to the card (see example). I found this height value from the type: custom:button-card
icon: mdi:warehouse
color_type: card
entity: <entity_name>
show_state: true
show_name: false
tap_action:
action: call-service
service: mqtt.publish
data:
qos: '2'
topic: topic
payload: FIRE
retain: false
color: rgb(10, 162, 192)
state:
- color: rgb(165, 173, 206)
value: Complete
- color: rgb(112, 166, 67)
value: Ready
styles:
card:
- height: "calc((var(--row-size,1) * (var(--row-height) + var(--row-gap))) - var(--row-gap))"
layout_options:
grid_columns: 1
grid_rows: 1 Version Details: |
That seems to work better for a 1x1 grid with no name, but if you try to apply that to an icon with a name displayed in a x2 height or more grid, the name gets put all the way at the bottom. To fix it, it seems that you'd need something along the lines of this CSS: #container {
justify-content: center;
display: flex;
flex-direction: column;
}
#img-cell {
height: 48px;
}
#img-cell + * {
margin-top: 8px;
} And |
Sorry guys, i don’t get it. (1) Calculating the height as @tfoote000 did, results in the same as setting the height to 100% via extra-styles. Cannot see any difference (2) The styles for #container and #img-cell which have @esand mentioned: without them everything seems ok. With them a simple custom button card (as posted above from me - only type and entity declaration) is broken. The icon takes up the whole space and entity name is cropped. Maybe you can give some images to illustrate what (1) and (2) should fix with a simple custom button card yaml? |
I'll have a look at this next week, in the meantime there should be a way to fix it with some styling config. |
As you can see, @tfoote000's fix works well for 1x1 buttons, but when you go bigger with a name, the spacing is off. The issue seems to just be with the computed height of the svg image. using @tfoote000's stuff it seems that it takes the max height which throws off the alignment to any text elsewhere - but for only an icon it will look fine. |
Hey, thanks for the examples. But i cannot confirm the false alignment - please look at this: On the right side there a 1x1 and 2x2 square, left 2x3 and 2x1
These are all custom button cards with nothing more than this: type: custom:button-card
entity: light.bad
layout_options:
grid_columns: 2
grid_rows: 3
styles:
card:
- border: 2px solid red
#setting the height to 100%
extra_styles: |
#alternative setting the height to 100%
|
@Kanecaine for reference, this is a regular button card with name displayed (2x2 grid): And... I think you have something else loaded that is impacting those cards you posted if you're saying there's no extra styles being applied, because this is what I see when creating a pretty simple custom button with no extra styles: These are the issues that others are pointing out - cards aren't taking full height to be properly sized and icon/text positioning is impacted as well. |
Sorry for the misunderstanding. When I wrote “with nothing more than this” i meant: this and the styles / extra-styles previously discussed. I edited my previous post to clarify that. However, I cannot understand the problem with the shifted text. I see that you also have “size: 48px” in your card config. Maybe that is the cause. So far no one else has expressed this problem with the text here. I think we should wait until Jerome has had a look at it. |
Thank you for the detailed explanation. I haven't tried to reproduce it, but now I understand what you mean. Seems to be a consequence of the fact that we are now stretching the card to 100%, a consequential error so to speak. |
Would be great if you could add 'Section' support in the view.
At the moment, we can't put cards side by side, only 1x1 using sections.
Thanks
The text was updated successfully, but these errors were encountered: