Different button background when on/off

Is the feature of having two backgrounds still available?
In v0 I could use this code (to have a different background when the button is on or off):

:host
background-color:default;
color:white;
text-transform:none;
background-image:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAYAAAB5fY51AAAACXBIWXMAAK0DAACtAwGwAEtUAAAF8WlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxNDAgNzkuMTYwNDUxLCAyMDE3LzA1LzA2LTAxOjA4OjIxICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIgeG1sbnM6cGhvdG9zaG9wPSJodHRwOi8vbnMuYWRvYmUuY29tL3Bob3Rvc2hvcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RFdnQ9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZUV2ZW50IyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ0MgKE1hY2ludG9zaCkiIHhtcDpDcmVhdGVEYXRlPSIyMDIwLTAzLTEzVDEzOjAwOjIzKzAyOjAwIiB4bXA6TW9kaWZ5RGF0ZT0iMjAyMC0wMy0xM1QxMzoyNjoxMyswMjowMCIgeG1wOk1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ECwAwQIQLGA/lcQKgAsLQLAAwQIQLADBAgQLQLAABAsQLADBAhAsQLAABAtAsADBAhAsgBsXvigUWGljmWQAAAAASUVORK5CYII=');
background-position:center center; 
background-size:95%; 
}

.on {
background-color:orange;
background-position:center center; 
background-size:95%; 
background-image:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAMAAABOo35HAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAAlwSFlzAACtAwAArQMBsABLVAAAAd1QTFRFR3BMOz9FPD5FOz5FOz9FOz9FOz9FOz9FNjo/Oz9FREdLOz9FOz9FOkBEOz9FOz9FOz9FOz9FP0FGOz9FOz9FOz9FOj9FOz9FPD9ENzlIOz9FOz9FPD9EOz9FOz9FOz9FOz9FOz9FOz9FOz9FOz9FOz9FOz5FOj9FOz9FOz9FOz9FOz9FOz9FOz9FOz9FOz9FOz9FOz9FOz5FOz9FOz5FOz9FOz9FOz9FOz9FOj9FOz9FOz9FOz9FOz5FOz9FOz9FOz9FOz9FOz9FOkBEOj9FOz9FOz5FNDhNOz1EOz9FOz9EOz9FOz9FOz9FOz9FOz9FOz9FOz9FOz9FOj9FOz9FOz9FOz9FOz9FOj5FOz9FOj5FOz9EN0FEOz9FOz9FOz9FOz9EOz5EOz9GOz9FOz9FOz9GOkBEOj5EOz9FOz9EOz5FOz9FOz9FOz9FOz9FOz9FOz9FOz9FOz9FOz9FPT9DOz9FOz9FOz9FOjxGOz9FOz9FOz9FOj9FOz9EMzZMOz9FOz9FOz9FOz9FOz9EOz9FOj9EOz9FOz9FOz9FOkBEOz9FOz9FOz9FOz9FOz9FOz9FOz9FOz9FOz9FOz9FPD5HOz9FOz9FPD5GOz9FOz9FOz9FOz9FOz9FOz9FOz9FK6hnAwAAAJ50Uk5TAP4cEf31+IABCQPUDh8qquw4BvH7d1RfBArzPAh51dFIkvlL+pa4Kd+Euamj3QWN9BUy5oe1aenDXLfk7RlXx73PPyMsfEoCInK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nyPAzSTijCW7jGNap3yrUTja38y7F8flNvWhO1k4/dzJI0YwvSOzn/TDs98MdnM67IuqLFcO30Iai2o9I7CKfJMdOU3dupnWJE53bH9a8QzLCJgYWxxuUkTeF/OBM13/vt147hwsqaNO9eSFb9jbCVnNn+nfy4qtrmBsWPgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgv3wX8/8dVPI19B5AAAAAElFTkSuQmCC');
}

But in v1 something must've changed because only the :host image is used.
Help? :rescue_worker_helmet:

1 Like

Writing :host.on instead of .on should work.

1 Like

It worked!

Example (.GIF)

For what it's worth, simply using the label property: checkbox.json (978 Bytes)

1 Like

The first pair of quotes = when the button is set to value 1
The second pair of quotes = ... 0

Shouldn't these two depend on the values that the user inputs in the on and off fields?

Sure, that's a simple example but you could write #{@{this} == @{this.on} ? "^check" : ""}

2 Likes

Hey there and sorry for bringing this topic up again. I was just searching if someone had created a nice checkbox class.

To maybe complete this topic for other users I'd like to mention that you need to exchange the comma in the above answer with a ":"

#{@{this} == @{this.on} ? "^check" : ""}
2 Likes

Indeed my mistake !

1 Like