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? }]. Filter types: 'select', 'text', 'checkbox'
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-allEmitted 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.

Props

| Name | Type | Required | Default | Description | | ------------------- | -------------------------------------------------- | -------- | ---------------------------------------------- | -------------------------------------- | ---- | ----------------------------------------------------------------------------------------------------------------------------------------------- | | filters | Array<{key: string, label: string, type: 'select' | 'text' | 'checkbox', options: Array, value: any}> | | [] | Filter definitions. Each item has key, label, type ('select'|'text'|'checkbox'), optional options (for select), and optional value. | | searchValue | string | | '' | Current search text | | searchPlaceholder | string | | () =&gt; t('nextcloud-vue', 'Search...') | Search input placeholder text | | showClearAll | boolean | | true | Whether to show the "Clear all" button | | clearAllLabel | string | | () =&gt; t('nextcloud-vue', 'Clear filters') | Clear all button label |

Events

NamePayloadDescription
search
clear-all
filter-changeEmitted when any filter changes.