-
-
Notifications
You must be signed in to change notification settings - Fork 30
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
Allow variables to have default values #1
Labels
Comments
I'm experimenting with this, it's easier to manage than inlined default values. What do you think? input_select_menu_item:
default:
- spin: false
card:
type: custom:button-card
template: menu_header
entity: '[[entity]]'
name: '[[item]]'
icon: '[[icon]]'
tap_action:
action: call-service
service: input_select.select_option
service_data:
entity_id: '[[entity]]'
option: '[[item]]'
state:
- value: '[[item]]'
color: white
name: ▾ [[item]] ▾
spin: '[[spin]]'
- operator: default
color: var(--paper-card-background-color) |
I like it. It actually makes it very clear that default values exists and thus specifying them in the card instantiation is optional. |
Merged
Works great. Thank you. |
🎉 This issue has been resolved in version 1.0.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Enhancement Request.
I have 30+ button cards in my HA instance and I am now using the decluttering-card to provide a consistent behavior and style for all the buttons on all the views. This has worked great in that it allows me to update this one card to change the behavior (ie. tap_action) or style (ie. label color) across the entire site!
I have found that there are occasions where I need a few cards to be slightly different than what was defined in the decluttering-card. I don't want to create another variable and have the color specified in the variable section of every instance of the card, as it defeats the purpose of making a single change to update the style for all the cards. I could also duplicate the decluttering-card and specify the one item that's different, but again, it defeats the purpose of decluttering-card.
It would be nice if I could specify a variable in the decluttering-card, but have a default value if I don't specify it when using the card. For instance, I may want the labels on all my cards to be blue, but I need a few of them to be red for whatever reason. I would like to specify the blue style color in the decluttering-card, but allow the variable to be overridden with the color red for the specific button instantiation.
A decluttering-card configuration may look like this:
The text was updated successfully, but these errors were encountered: