CnFilterBar
Search and filter controls row for list views. Renders a text search input, zero or more typed filter controls (select, text, checkbox), and an optional "Clear filters" button.
Wraps: NcTextField, NcSelect, NcButton, NcCheckboxRadioSwitch
Try it
Loading CnFilterBar playground…
Anatomy
+------------------------------------------------------------+
| [🔍 Search...] | [All types ▾] | [✓ Active only] | [Clear filters]
+------------------------------------------------------------+
↑ ↑ ↑ ↑
search input select filter checkbox filter clear all
| Region | Description |
|---|---|
| Search input | Free-text search; emits search on every keystroke. Shows a clear (×) button while text is entered |
| Filter controls | One control per entry in :filters. Type select renders NcSelect, text renders NcTextField, checkbox renders NcCheckboxRadioSwitch |
| Clear filters | Appears when any filter or the search term is non-empty (when showClearAll is true); emits clear-all |
Usage
<CnFilterBar
:search-value="searchTerm"
search-placeholder="Search clients..."
:filters="[
{ key: 'type', label: 'All types', type: 'select', options: typeOptions, value: selectedType },
{ key: 'active', label: 'Active only', type: 'checkbox', value: showActiveOnly },
]"
@search="onSearch"
@filter-change="onFilterChange"
@clear-all="clearFilters" />
Props
| Prop | Type | Default | Description |
|---|---|---|---|
filters | Array | [] | Filter definitions for embedded filter controls: [{ key, label, type, options?, value?, fromLabel?, toLabel?, testid? }]. Filter types: 'select', 'text', 'checkbox', 'range' (two number fields) and 'dateRange' (two date fields). A range's value is { gte, lte }, its bounds are named "{label}, from" and "{label}, up to" unless fromLabel / toLabel say otherwise, and testid gets -from / -to on its two fields |
showSearch | Boolean | true | Show the search field; false draws a bar of filters only |
searchValue | String | '' | Current search term (controlled) |
searchPlaceholder | String | 'Search...' | Placeholder text for the search input |
showClearAll | Boolean | true | Show a "Clear filters" button when any filter is active |
clearAllLabel | String | 'Clear filters' | Label for the clear-all button |
Events
| Event | Payload | Description |
|---|---|---|
search | term | Emitted when the search input value changes |
filter-change | { key, value } | Emitted when any filter value changes; includes the filter key and new value |
clear-all | — | Emitted when the clear-all button is clicked |
Reference (auto-generated)
The tables below are generated from the SFC source via vue-docgen-cli. They reflect what's actually in CnFilterBar.vue and update automatically whenever the component changes.
OpenRegister reliance
none: this component does not touch OpenRegister, directly or through anything it imports. 0 direct references, 0 files reached through imports.
See the reliance overview for the filterable list.
Props
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
filters | Array<{key: string, label: string, type: 'select'|'text'|'checkbox'|'range'|'dateRange', options: Array, value: unknown, fromLabel: string, toLabel: string, testid: string}> | [] | Filter definitions. Each item has key, label, type ('select'|'text'|'checkbox'|'range'|'dateRange'), optional options (for select), optional value ({ gte, lte } for a range), optional fromLabel/toLabel (a range's bound names) and optional testid. | |
showSearch | boolean | true | Whether to show the search field. | |
searchValue | string | '' | Current search text | |
searchPlaceholder | string | () => t('nextcloud-vue', 'Search…') | Search input placeholder text | |
showClearAll | boolean | true | Whether to show the "Clear all" button | |
clearAllLabel | string | () => t('nextcloud-vue', 'Clear filters') | Clear all button label |
Events
| Name | Payload | Description |
|---|---|---|
search | — | |
clear-all | — | |
filter-change | — | Emitted when any filter changes. |