Closed tmcw closed 6 years ago
I think the value of DOM.select is somewhat questionable and I wonder whether we should provide it at all. You can create a SELECT element easily with an html
tagged template literal:
viewof choice = html`<select>
<option value="red">Paint it red</option>
<option value="green">Not easy being</option>
<option value="blue">A case of</option>
</select>`
Or using array.map:
options = [
["red", "Paint it red"],
["green", "Not easy being"],
["blue", "A case of"]
]
viewof choice = html`<select>${options.map(([value, label]) => `
<option value="${value}">${label}</option>`)
}</select>`
Closing in favor of html
.
Something like:
To generate something like
The gist is, well, there are plenty of cases where values don't work well as labels in a UI.
We could also do it with objects, but thinking
[[k, v]...]
format is how you can create aMap
object, so it isn't too exotic. Question here is how 'high-level' stdlib aims to be.