Skip to main content

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
RegionDescription
Search inputFree-text search; emits search on every keystroke. Shows a clear (×) button while text is entered
Filter controlsOne control per entry in :filters. Type select renders NcSelect, text renders NcTextField, checkbox renders NcCheckboxRadioSwitch
Clear filtersAppears 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​

PropTypeDefaultDescription
filtersArray[]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
showSearchBooleantrueShow the search field; false draws a bar of filters only
searchValueString''Current search term (controlled)
searchPlaceholderString'Search...'Placeholder text for the search input
showClearAllBooleantrueShow a "Clear filters" button when any filter is active
clearAllLabelString'Clear filters'Label for the clear-all button

Events​

EventPayloadDescription
searchtermEmitted 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​

NameTypeRequiredDefaultDescription
filtersArray<{key: string, label: string, type: 'select'&#124;'text'&#124;'checkbox'&#124;'range'&#124;'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.
showSearchbooleantrueWhether to show the search field.
searchValuestring''Current search text
searchPlaceholderstring() =&gt; t('nextcloud-vue', 'Search…')Search input placeholder text
showClearAllbooleantrueWhether to show the "Clear all" button
clearAllLabelstring() =&gt; t('nextcloud-vue', 'Clear filters')Clear all button label

Events​

NamePayloadDescription
search—
clear-all—
filter-change—Emitted when any filter changes.