I'm trying to create a similar feature on a leaflet map in Shiny, where there are colored icons next to each checkbox that match the points on the map. Sort of like a combination checkbox/legend.
Shiny Widgets has some checkbox styling options, but they all change the styling of the actual checkbox, whereas I'd like to insert icons/colors next to the checkbox. The closest thing I've found is something like what's mentioned here, where the user wanted to use an image as an option for a radio button/checkbox, but it would be absolutely wonderful if there were some way to integrate this with the color-coding of the points on the leaflet map (since I've already specified those colors in the leaflet palette) instead of having to e.g. create png swatches of each color and manually include them in the code.
Does anyone have resources/leads they can point me to on this? Any idea if it's possible?
Just a minor formatting question that maybe you or someone else can help with: in your original example, the dots and labels showed up at different heights than the check boxes, like this:
I added margin-top:3px; after e.g. color:lightblue; which fixed the height of the dots nicely:
But the text labels are still not aligned. Playing around with margin-top and margin-bottom for the text labels didn't do anything. Sorry if this is obvious--I haven't worked with html before. Do you know how I might fix the alignment?
Reprex is here (lightly modified from your original)
Wow, thank you so much! I thought you were missing my point about the vertical alignment, but then I went back and actually tried your padding fix, and voilà, it fixes the problem.
Thank you for your patience and solution--this really makes my day!