default value for select widget
InfGame opened this issue · 1 comments
Heya! I have a select widget for a color theme that i use in many templates of mine:
colorStyle {
label: Color;
widget: select;
options: Red=Rot|Green=Grün|Blue=Taubenblau|DarkBlue=Dunkelblau|Oliv|Neutral;
}
Tho i would like a different theme to be the default on different templates.
Is there any way to define a default value on a select widget?
The selections reffere back to a list of hexcodes that are used in an element's css that uses the theme like this:
-ko-background-color: @[colorStyle == 'Green' ? '#ebf1eb' : colorStyle == 'Blue' ? '#e9f0f5' : colorStyle == 'DarkBlue' ? '#e5ecf0' : colorStyle == 'Oliv' ? '#edeeec' : colorStyle == 'Neutral' ? '#f3eeea' : '#f5e6e9']
Defaults are not a widget thing, but a "variable" thing. Most times the default is automatically read from the HTML/CSS value, but in your case you use an expression so Mosaico is not able to guess it and you have to make it explicit in the block definition, e.g:
myBlock {
properties: **colorStyle=Blue** otherProps anotherOne;
}