had 2 issues at least: a wrong js code, should be window.location.pathname and in my case moe specifically window.location.pathname.split('/')[1] to get the dahsboard url. Secondly, I had an incorrectly placed ‘(’ in the bottom variables path…
this is working fine now, but still feels somewhat complex, having to repeat the template on all options. did post in the state-switch thread, hope that could simplify things a bit, if at all possible, now or in the future.
ha, yes, that’s cool of course. Makes it easier on the eye indeed. Will adjust like that.
Thanks!
Won’t that interfere with the variable option I already use in the button itself?
Still, I’d need that for all options… so it wont really make it much shorter.
a bit late to the party on this subject, but has it been added to the butt0n-card options? cant find anything on it, and need some hovering popup texts, just like with Custom Header:
It would be possible if variables where evaluated in the order they are declared, but it’s not the case since the variables object is a map (unordered), not an array (ordered). I can probably introduce something to cover for that edge case.
It may not be possible on the full button because it requires HTML to exist. You definitely can place it on the labels/names/states/custom_field by adding the HTML in a template.
and I’d like the tooltip to show the value of [[[ return variables.path.replace('_',' ').toUppercase() ]]]. Maybe even simpler, have it show the title of the view (though this not in the button config yet).
title: Weer & Klimaat
path: weer_klimaat
icon: mdi:weather-partly-cloudy
would you try and fit it in this button config individually, or, hoping to cut some extra code, considering it would be identical for all buttons, add it to the used button template:
Hi, I have a silly question but definately no idea how to solve.
Im displaying an input_number state.
This state is always shown as X.X
How can I template the state and show the number without ,x only like an integer?
yes, I saw that, thanks, and tried various things with it…
button_shortcut_menu:
name: >
[[[
return `<div class="tooltip">Hover over me
<span class="tooltiptext">Tooltip text</span>
</div>`
]]]
or
button_shortcut_menu:
name: >
<div class="tooltip">Hover over me
<span class="tooltiptext">Tooltip text</span>
</div> ]]]
the top doesn’t show anything, the bottom does this:
so I am on the wrong track here, missing the obvious (or not so…)
also tried to use a custom_field ‘tooltip’ which seemed appropriate, but again, nothing happening, probably also because I haven’t set any styles yet, relying on the default settings for starters.
extra_styles: |
/* Tooltip container */
.tooltip {
position: relative;
display: inline-block;
border-bottom: 1px dotted black; /* If you want dots under the hoverable text */
}
/* Tooltip text */
.tooltip .tooltiptext {
visibility: hidden;
width: 120px;
background-color: black;
color: #fff;
text-align: center;
padding: 5px 0;
border-radius: 6px;
/* Position the tooltip text - see examples below! */
position: absolute;
z-index: 1;
}
/* Show the tooltip text when you mouse over the tooltip container */
.tooltip:hover .tooltiptext {
visibility: visible;
}