Skip to content

Instantly share code, notes, and snippets.

@rodolfojnn
Created January 3, 2022 13:41
Show Gist options
  • Save rodolfojnn/be9e13630eea22386cb92db4d6d68129 to your computer and use it in GitHub Desktop.
Save rodolfojnn/be9e13630eea22386cb92db4d6d68129 to your computer and use it in GitHub Desktop.
<div
x-data="{
search: '',
items: ['foo', 'bar', 'baz'],
get filteredItems() {
return this.items.filter(
i => i.startsWith(this.search)
)
}
}"
>
<input x-model="search" placeholder="Search...">
<ul>
<template x-for="item in filteredItems" :key="item">
<li x-text="item"></li>
</template>
</ul>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment