SP-Picker Menu Items Icons

Using the SP-Picker has anyone managed to use Icons in the drop down list

Didn’t bother to style properly (probably you don’t even need the <div class="icon">), but here you go

  <sp-menu slot="options">
    <sp-menu-item value="">
      <div style="display: flex; flex-direction: row;">
        <div class="icon">
          <svg xmlns="http://www.w3.org/2000/svg" height="18" viewBox="0 0 18 18" width="18">{ALL SVG STUFF}</svg>
    <sp-menu-item value="" selected="true">
      <!-- ... -->


@Karmalakas Thank You for the code appreciated.
This brings me to something else which has been on my mind.


What does this slot do, I see it a-lot in code examples

Most likely some Spectrum specific stuff :man_shrugging:

If you check sp-dropdown UXP docs, you’ll find it in the example, but I personally couldn’t make sp-dropdown work in UXP, so had to improvise and started experimenting by mixing Spectrum Web Components with Spectrum UXP and sp-picker (which is not even documented under UXP) worked just fine.

So basically I have no certain answer :slightly_smiling_face: I assume it’s similar to slot="icon" - like defining as a placeholder or something. I mean, probably there’s some placeholder inside sp- components and defining it as an attribute, puts that element into that placeholder. I’m purely speculating here :smiley: