I can't tell you how it's done, but I can tell you of a couple other mods with search boxes so that you can check their code.
ArkInventory
DogTag-3.0 library
ItemSync
LootLink
OptionHouse
... there was another one or two in my brain, but I lost them.