Associate an sl-input
with a <datalist>
or similar
#433
Replies: 2 comments 5 replies
-
I wish I had more experience with datalists, but I don't believe you can because the input is in a shadow root. You'd need to modify the component or inject it into the input's shadow root (not recommended). What's the use case? Looks like maybe an autocomplete. I'm not sure I'd go with datalist for that — I've heard some complaints about it but haven't taken the time to dive in myself. |
Beta Was this translation helpful? Give feedback.
-
While I have limited experience in web components and shadow DOM, and it's not clear what's too bad about injecting a datalist into the sl-input's shadow root for now, but it worked fine for me (though you need to inject it any time you change the datalist):
Pictured below is Linux Chrome. |
Beta Was this translation helpful? Give feedback.
-
is it possible to achieve something similar to this:
With Shoelace's
sl-input
?Or would I have to wire up some javascript?
I found a discussion here:
#127
but it seems more related to tag selecting than for a search input.
Beta Was this translation helpful? Give feedback.
All reactions