custom-cards / button-card

❇️ Lovelace button-card for home assistant
MIT License
1.97k stars 242 forks source link

Prevent Notification overflowing card #732

Open Mariusthvdb opened 1 year ago

Mariusthvdb commented 1 year ago

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Since this probably isnt an issue, but user error, please let me post it as FR..

Having a notification with dynamic text strings possibly overflow the card, especially when on mobile.

https://github.com/custom-cards/button-card/assets/33354141/f0d99546-6f95-4e5c-9709-616ca8f8f287

note it does respect the card padding on the right, but not on the left

Describe the solution you'd like A clear and concise description of what you want to happen.

Would love to have some default setting for these custom_fields to never overflow the card, maybe even use newline or some other clever way of preventing it.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Ive tried to prevent it by setting a max-width, but that is a bit silly in 2 ways: first it is not required on the desktop card, only on the mobile card, since that is smaller

second, it truncates the text with ending ... replacing the text it would otherwise show ;-)

20230726_092742000_iOS

Ive alsof tried:

      - word-break: break-all

but it does exactly nothing, even though W3 states:

To prevent overflow, word may be broken at any character

which is exactly what I am after...

Additional context Add any other context or screenshots about the feature request here.

Nevermind the notification showing over the icon, that is on purpose/not an issue.

andyblac commented 1 year ago

have you tried using % as font size instead of px, this should then scale the font by the card size.

like I did here, I used

    label:
      - font-weight: "bold"
      - font-size: "90%"

From Mac

Screenshot 2023-08-15 at 10 09 03

From iPhone

Screenshot 2023-08-15 at 10 09 16