JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text" placeholder="Enter some text..." data-bind="value: text, valueUpdate: 'afterkeydown'" />
<select data-bind="options: suggestions"></select>
<button ></button>
JavaScript
var VM = function () {
this.text = ko.observable('').extend({ required: true })
this.suggestionStrings = [
'Hello',
'world',
'name',
'richard'
];
this.suggestions = ko.computed(function () {
var text = this.text();
return ko.utils.arrayFilter(this.suggestionStrings, function (str) {
return new RegExp(text, 'i').test(str);
});
}, this);
};
ko.applyBindings(new VM());