docs(combo-box): add filterable example

This commit is contained in:
Eric Liu 2020-10-14 15:14:54 -07:00
commit 3b24d21168
2 changed files with 19 additions and 0 deletions

View file

@ -0,0 +1,15 @@
<script>
import { ComboBox } from "carbon-components-svelte";
function shouldFilterItem(item, value) {
if (!value) return true;
return item.text.toLowerCase().includes(value.toLowerCase());
}
</script>
<ComboBox
titleText="Contact"
placeholder="Select contact method"
items="{[{ id: '0', text: 'Slack' }, { id: '1', text: 'Email' }, { id: '2', text: 'Fax' }]}"
shouldFilterItem="{shouldFilterItem}"
/>