JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text" placeholder="Sort by..." id="search">
<div class="sortable-items">
<div>dogs</div>
<div>cats</div>
<div>dogs</div>
<div>dogs</div>
<div>cats</div>
<div>cats</div>
<div>dogs</div>
</div>
JavaScript
$('#search').keyup(function(){
var searchTerm = $(this).val(); //user inputted
$(".sortable-items div").each(function(){ //loop through the list
if($(this).text().match(searchTerm)){ //check if list item contains the search term
$(this).show();
}else{
$(this).hide();
}
});
});