Skip to content

Feature/add bar card #1711

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

headsoft-mikhail
Copy link

@headsoft-mikhail headsoft-mikhail commented May 17, 2025

Description

bar-card-dark

I've added new card "bar-card" that looks exactly like other cards with slider but slider ignores its interactions, so it's just a bar. Also main feature is that bar can change color from red to green depending entity value. New element basically comes from number-card.
UI editor was added for new card type.
Demo view was added for new card type.
Documentation was added for new card type.
Also I've added translations for parameters and their fixed values, but some of them may be a little clumsy (if so, I hope that people familiar with language will correct this).

Related Issue

This PR fixes or closes issue:
closes #387
closes #692
closes #1181

Motivation and Context

There is no suitable card for convenient display of sensors, batteries, air_quality devices. Many users (including me) want an element like “custom:bar-card”, which is poorly supported and does not fit the style of mushroom.

How Has This Been Tested

I've added this elements to Home assistant demo server, used new card on several elements like sensors, numbers, input_number_ air_quality.
Pass the test with different card parameters: entity, title, icon_color, min, max, enable_color_severity, severity_direction, appearance and actions with lots of combinations. Also I use this card in my own HA instance.
I've tested editor in some supported languages to test translations are applied correctly.
This not affects other elements because it's a separate card.

Types of changes

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • 🚀 New feature (non-breaking change which adds functionality)
  • 🌎 Translation (addition or update a translation)
  • ⚙️ Tech (code style improvement, performance improvement or dependencies bump)
  • 📚 Documentation (fix or addition in the documentation)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have tested the change locally.
  • I followed the steps if I add a new language .

@renedis
Copy link

renedis commented Jun 9, 2025

Looks awsome. Is there an option to set e.g. "bar-height: 4px" ?

I made somewhat this bar-card myself too and found it really needed to add this.

@headsoft-mikhail
Copy link
Author

headsoft-mikhail commented Jun 10, 2025

Looks awsome. Is there an option to set e.g. "bar-height: 4px" ?

I made somewhat this bar-card myself too and found it really needed to add this.

Thanks, @renedis!
I think this card as part of "mushroom" design system should match the appearance of the other cards. If there is a need to change the height of the bar, then it seems that this configuration option should be added to the base slider element, that will allow to adjust the width of all sliders, such as number-card, fan-card, humidifier-card, light-card. Looks like this PR is already big enough, better to open new issue about bar-height configuration option if it's required. Hope this PR will be merged soon 🤞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: Gauge based on number card [Feature]: Battery Card [Feature]: Bar Chart in Card
2 participants