Type-ahead search Rails + StimulusJS

Hi! I just started using Stimulus with Rails 5 and webpacker and have found it to be pretty easy to take on so far. I’m writing up what I’m learning and post up my first notes on leveraging Stimulus to do a type-ahead search:

Cheers,
Karl

4 Likes

I finished up the article in part 2:

Let me know what you think!

1 Like

This is awesome!
I’m curious, when developing this, had you come across either of these posts?

If so, I’d love to know what the key differences are!

Hi @miketheman! Thanks for the response. Lol no I hadn’t even bothered to look; I’d done autocomplete forms before with JQuery so was comfortable feeling this out on my own.

Let’s start with the second article as it’s easier: doesn’t take any Rails integration into account, it’s purely looking at Javascript and you have to figure out how to send a response back.

The first one’s pretty similar; there are a few minor differences like what routes they setup in rails to render the primary form and the response, but the principle is largely the same. They do a nice job adding some nice keyboard-based features for the search results that I like as well.