Faceted Filter
A filter component with multi-select options, search functionality, and optional item creation.
Preview
Installation
npx sigma-ui@latest add faceted-filterUsage
<script setup lang="ts">
import { ref } from 'vue';
import { FacetedFilter } from '@/components/ui/faceted-filter';
const selected = ref<string[]>([]);
</script>
<template>
<FacetedFilter
v-model="selected"
title="Status"
:options="['Backlog', 'Todo', 'Done']"
/>
</template>v-modelis the list of selected values.maxBadgeslimits how many selections are shown on the trigger before they collapse into a "+N" badge.allowCreateshows an Add button that emitscreatewhen the search matches nothing.
Examples
Basic
With Create Option
With Footer
API Reference
FacetedFilter
Props
| Prop | Type | Default |
|---|---|---|
titlerequiredLabel of the trigger button, also used as the search placeholder. | string | - |
optionsrequiredValues the user can pick from. | string[] | - |
modelValuerequiredCurrently selected values; use with | string[] | - |
maxBadgesMaximum number of selected values shown as badges in the trigger before collapsing into a "+N" badge. | number | 2 |
allowCreateShows an "Add" button that emits | boolean | false |
minWidthMinimum width of the dropdown, in pixels. | number | 200 |
Events
| Event | Payload |
|---|---|
update:modelValueEmitted with the new selection when an option is toggled. | [value: string[]] |
createEmitted with the trimmed search text when the user clicks the "Add" button. | [value: string] |
Slots
| Slot | Scope |
|---|---|
footerContent rendered below the options, separated by a divider. | - |
Accessibility
The trigger is a button that opens a listbox. Options are toggled with the keyboard, and selected values are exposed as badges.
| Key | Description |
|---|---|
| Tab | Moves focus to the trigger. |
| Enter or Space | Opens the list. |
| ArrowDown | Moves to the next option. |
| ArrowUp | Moves to the previous option. |
| Enter | Toggles the focused option. |
| Escape | Closes the list. |