Autocomplete for input fields

I am working on a project and would like to incorporate autocompletion of input fields. This proved awkward to do via just Javascript, so here is a more Anvil-oriented approach.

https://anvil.works/build#clone:6UTRODDGEM4PFM7K=APSZUGSV3YNJI7BNJEG7KXDC

8 Likes

Neat! Have you considered making this into a custom component that could be reused?

Probably not a bad idea with a little clean-up!

Awesome idea man. Love it!

Hi all - I needed an auto-complete function for 300,000+ UK addresses and added a few bells and whistles to the really helpful first version by @navigate (above).

Here’s what I came up with if you’d like to clone and evolve…

https://anvil.works/build#clone:HDGAOQTY7NEOKGLG=XUGH27UUZMJMLAX5OZ4W3TJK

Now if anyone can tell me how to remove the vertical blank space between results…? :crazy_face:

1 Like

Just in case it helps:

No idea how it stacks up to what this thread shows, but I put together a POC for a trie implementation a while ago. I think they are supposed to be really fast AFAIK.

clone and description:

If you are in need of speed it might help.

1 Like

Often setting the role of all labels and links to text helps removing all that padding.
If it works you are lucky. If it doesn’t you’ll need to dig in the CSS.

2 Likes

PSA: An Autocomplete component is also available as part of Anvil Extras.

1 Like