We've moved discussions to Discord

Autocomplete Text Field with tailwind css

Alex Deering
Looking to create an autocomplete textfield where it will query one of my reference tables.  I dont want to just make it a select box because they can create their own items that will get added to the reference table.  Before I was using materialize and it was included with the framework, so not sure how to make it with tailwind
Chris Oliver
Are you planning on building it from scratch or using a library? If you're using a library, you probably just need to update their html/styling.
Dan Weaver
You'll need JS for that and Tailwind doesn't include or use any JS. It's pure CSS.

Build the JS part yourself, or as Chris said use a library, then use Tailwind for the styling. It comes with some decent form element styles already.
Alex Deering
do you have a recommendation for a library to use?  Getting use to rails 6, web packer, and stimulus so a little different then Ive done in the past
Dan Weaver
Here's a Stimulus autocomplete: https://github.com/afcapel/stimulus-autocomplete

Doesn't have the 'add a new item' function though.
Alex Deering
Thats fine with the add new, im actually manually doing that with a function in the model which does what I want anyways.  Was looking at the easy-autocomplete library as well...for the stimulus-autocomplete which file do I add the import to, is it the application.js file? 
Notifications
You’re not receiving notifications from this thread.