This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Lukas Guschlbauer
Posted Feb 09 - Read on Facebook

Hey! I'm trying to achieve a search-field that filters an array.

I'm using Jordan Robert Dobsons "framer-InputField"-module, and on keyDown I'd like to filter an array of items that match the current input value. Also the matching letters in the items should be highlighted. (So actually just like Google Search Suggestions)

How would you go about it? I didn't try much yet, but I might have used a "indexOf()"-function loop through the items array to show those elements, but if somebody knows how to do it and maybe even has a prototype, I'd be your fanboy4life... ;)

4 Comments

Jordan Robert Dobson

So I assume you're using a few of the included events in the module... there is a regex match feature you could use... I also think you could just look for an input change use one of the events and do a contains match in lodash...

color = "blue"

print _.find color, ["red", "green", "blue"]

Jordan Robert Dobson

Try it and see. :) I don't think so at least.

Jordan Robert Dobson

I can't recall also if I let match be an array as well. I thought I did. There is an event for match as well.

Lukas Guschlbauer

Kind of getting there: https://framer.cloud/utFSM/

Read the entire post on Facebook