Ga naar hoofdinhoud

CnQuickFilterBar

A clickable tab strip rendered above the table inside CnIndexPage when the manifest declares pages[].config.quickFilters. Each tab carries a filter map that the parent merges into the useListView fetch when the tab is active.

Visual: a horizontal row of pill-shaped buttons; the active one is filled with the primary colour, the rest outlined. It's a thin styled <button> list rather than NcAppNavigation* — this lives inside the index page, not as the app's main nav.

Try it​

<CnQuickFilterBar
:tabs="[
{ label: 'Open', filter: { status: 'open' } },
{ label: 'Closed', filter: { status: 'closed' } },
]"
:active-index="0"
@update:active-index="onChange" />

In manifests:

{
"id": "Tasks",
"type": "index",
"config": {
"register": "app",
"schema": "task",
"quickFilters": [
{ "label": "Open", "filter": { "status": "open" }, "default": true },
{ "label": "Closed", "filter": { "status": "closed" } },
{ "label": "Mine", "filter": { "assignee": "@route.userId" } }
]
}
}

CnIndexPage reads quickFilters and renders this bar automatically; consumers usually don't mount CnQuickFilterBar directly.

Props​

PropTypeDefaultDescription
tabsArray(required)Tab definitions. Each entry is { label, filter, default?, icon? }. filter is consumed by the parent (CnIndexPage merges it into the fetch), not by this component.
activeIndexNumbernullZero-based index of the currently active tab, or null for none active. Pair it with @update:active-index (or v-model:active-index); the removed Vue-2 model option means a bare v-model binds nothing.
inlineBooleanfalseRender bare (no padding / bottom border / background) for embedding inline inside another bar — e.g. the #filters slot of CnActionsBar, so the tabs sit beside the view toggle instead of as a separate row.
maxVisibleNumber0Chips mode only: how many pills render inline before the rest move behind an overflow chip. 0 renders every tab.
fitBooleanfalseChips mode only: show as many chips as the bar's width holds and move the rest behind the overflow chip, measured again when the width, the tabs or the counts change. The bar takes the room it is given. With maxVisible too, the smaller of the two wins.
countsObject | ArraynullHow many records each tab matches, keyed by tab index. A tab with a number shows it after its label. A tab can also carry its own count. null shows no counts.

Events​

EventPayloadWhen
update:active-indexNumberEmitted when the user clicks a different tab. The parent updates its own state and triggers the re-fetch (CnIndexPage's onQuickFilterChange).

Slots​

None — labels and icons are declarative via the tabs prop.

Styling​

Pill-shaped buttons. Active state uses --color-primary-element / --color-primary-element-text (NL Design + dark/light themes work out of the box). Tab strip uses --color-main-background with a bottom border (--color-border).

Override via your app's CSS if needed — the component exposes .cn-quick-filter-bar, .cn-quick-filter-bar__tabs, .cn-quick-filter-bar__tab, .cn-quick-filter-bar__tab--active, .cn-quick-filter-bar__label, .cn-quick-filter-bar__icon class names, and for the overflow .cn-quick-filter-bar__more, .cn-quick-filter-bar__more--icon-only, .cn-quick-filter-bar__more-panel, .cn-quick-filter-bar__more-list and .cn-quick-filter-bar__more-item.

Set mode="dropdown" to render a single NcSelect instead of the chip strip (the empty-filter "All" tab is dropped — an empty selection means all). Set multiple to allow several filters active at once; the selection is exposed via the selectedIndices array prop + update:selected-indices event (the host ORs the selected tabs' filters into one fetch). selectLabel / placeholder label the dropdown. On a manifest type:"index" page, drive both from config.quickFilterMode and config.quickFilterMultiple.

Labels are translated​

A tab's label goes through the host's label lookup (cnTranslate, provided by CnAppRoot) before it is drawn, so a manifest key such as Mine reads Mijn zaken in Dutch. Without a lookup the label renders as written. The same holds for the attention card copy of CnBannerWidget, the title and countLabel of CnStatsBlock, and the footerNote and bulkHint of CnIndexPage.

Overflow chip​

A page with more than a handful of lenses wraps the strip onto a second line and squeezes whatever shares the bar with it — on CnIndexPage that is the "Showing X of Y" count. Set maxVisible (manifest: config.quickFilterMaxVisible) to keep the everyday few as pills and put the rest behind one more chip:

"quickFilters": [ … 15 lenses … ],
"quickFilterMaxVisible": 4

The overflow is a chip and not a toolbar button — a button would break the strip's rhythm into "badge, badge, badge, control", and the thing it opens is a filter like the ones beside it. So it wears the same pill, sits at the end of the row as a bare ⋯ while nothing behind it is on, and opens a small panel of more chips rather than a menu of text rows.

The visible set is the first maxVisible entries in declared order, so reorder quickFilters to change which lenses stay out — there is no per-entry pin. Picking a lens from the panel applies it exactly as clicking a pill does and closes the panel; in multiple mode the panel stays open so several can be toggled in one visit. An active hidden lens moves its label and its primary fill onto the chip (2 filters when more than one is on in multiple mode), so a narrowed list never presents itself as "All". maxVisible is ignored in dropdown mode, which already collapses every lens into one control.

Counts​

A tab can show how many records it matches. On a CnIndexPage you opt in per quick filter with showCount: true:

"quickFilters": [
{ "label": "Open", "filter": { "status": "open" }, "showCount": true, "default": true },
{ "label": "On hold", "filter": { "status": "hold" }, "showCount": true },
{ "label": "Closed", "filter": { "status": "closed" } }
]

The page fetches the counts for you. Tabs that filter the same single field share one grouped request, so the three tabs above cost one request, not three. A tab with any other filter costs one count request. A tab without showCount costs nothing and shows no number. A filter that holds a list of values ({ "status": ["open", "hold"] }) is counted through the list endpoint, sent the same way the list request sends it, because the aggregation endpoints cannot express "one of these".

Used on its own, the bar shows whatever you pass in counts (or as count on a tab) and fetches nothing. The count is part of the tab's text, so a screen reader reads "Open 12".

See also​

Board look​

Under the board look the tabs are chips, pressed buttons (aria-pressed) in a group, 38px high with a count badge, the selected one filled with the main text colour.