I just love Input.select. What an amazingly simple API.
I am wondering if there is anyway to style the selections in the dropdown menu? Specifically I am interested in adding colour to the text. So take for example this dropdown menu:
viewof menu = Inputs.select(["one", "two"], {value: "one", label: "Drop down"})
Is there any way to add these colours to the text in the dropdown?
The Input APIs seem to be simple JavaScript wrappers over the basic HTML form elements, and thatās not something you can do with raw HTML at this point.
Looks like it should be possible. I only went so far as re-constructing Saneefās example, which is not a drop-down selector, but it overall appears to work by just passing in CSS:
This is SO amazing. For my purposes I really donāt want users to be able to select multiple but even just this thread is an absolute treasure. Thank you!
I should probably have added that I would not recommend emulating a dropdown this way. Overlays donāt work well in Observable as their visible region is limited to the sandbox iframe and theyāll be covered by any open or pinned editors. This particular implementation is also an accessibility nightmare.
Still, you can do quite a lot with radios. See these options for example:
Inputs.table() also lets you use radios if you set its multiple option to false: