Filter
The parts of a storefront filter: option lists with counts and search, swatches, a price range, ratings and switches, in groups that open in place or as a popover and reset together.
Parts
| Part | File | Does |
|---|---|---|
| Filter | Filter.vue | Groups all parts of the filter and lets the user reset them together. |
| FilterField | FilterField.vue | Groups the title, control and description of one filter option. |
| FilterFieldContent | FilterFieldContent.vue | Stacks a filter option's label and description beside its control. |
| FilterFieldDescription | FilterFieldDescription.vue | Explains a filter option below its label. |
| FilterFieldLabel | FilterFieldLabel.vue | Labels the control of a filter option. |
| FilterFieldTitle | FilterFieldTitle.vue | Names a group of filter options. |
| FilterGroup | FilterGroup.vue | Shows a labelled set of filter options that opens and closes. |
| FilterList | FilterList.vue | Lists filter options with result counts that the user can toggle and search. |
| FilterTrigger | FilterTrigger.vue | Opens and closes a filter group, showing its label and count of active options. |
| FilterPrice | FilterPrice.vue | Lets the user limit products to a price range with a slider. |
| FilterRange | FilterRange.vue | Lets the user limit a value by typing a lowest and highest number. |
| FilterRating | FilterRating.vue | Lets the user limit products to those with a minimum star rating. |
| FilterReset | FilterReset.vue | Lets the user clear all filters at once. |
| FilterSlider | FilterSlider.vue | Lets the user limit a numeric value to a range with a slider. |
| FilterSwatch | FilterSwatch.vue | Lists colour options as swatches that the user can toggle. |
| FilterSwitch | FilterSwitch.vue | Lets the user turn a yes-or-no filter on or off. |
Anatomy
<Filter>
<FilterSwitch>
<FilterField>
<FilterFieldContent>
<FilterFieldLabel />
<FilterFieldDescription />
</FilterFieldContent>
</FilterField>
</FilterSwitch>
<FilterGroup>
<FilterList />
<FilterSwatch />
<FilterPrice>
<FilterSlider>
<FilterField>
<FilterFieldTitle />
<FilterFieldDescription />
</FilterField>
</FilterSlider>
</FilterPrice>
<FilterRange>
<FilterField>
<FilterFieldTitle />
<FilterFieldDescription />
</FilterField>
</FilterRange>
<FilterRating>
<FilterField>
<FilterFieldTitle />
</FilterField>
</FilterRating>
</FilterGroup>
<FilterReset />
</Filter>Styling
All of Filter’s styles live in filter.json. New to styling in Frontic UI? How styling works →
Install
- npm packages
- @lucide/vue
- @vueuse/core
- class-variance-authority
- reka-ui
Built from
API reference
Groups all parts of the filter and lets the user reset them together. Renders a <div>.
Props 4
| Prop | Type | Default | |
|---|---|---|---|
| asChild | boolean | false | |
| |||
| as | AsTag | Component | 'div' | |
| |||
| class | ClassValue | — | |
| |||
| reset | (() => void) | — | |
| |||