Skip to main content

CnActionsBar

Toolbar that combines an item count display, a primary Add button, a view-mode toggle (Cards / Table), and an overflow actions menu containing Refresh, Import, Export, Copy-selected, and Delete-selected. All built-in mass actions are individually toggle-able.

Wraps: NcButton, NcActions

Try it

Loading CnActionsBar playground…

Usage

<CnActionsBar
:pagination="pagination"
:object-count="items.length"
:selected-ids="selectedIds"
add-label="Add Client"
add-icon="AccountGroup"
@add="createNew"
@refresh="reload"
@show-import="openImport"
@show-export="openExport"
@show-copy="openMassCopy"
@show-delete="openMassDelete"
@view-mode-change="viewMode = $event" />

Custom action items can be injected into the overflow menu:

<CnActionsBar ...>
<template #action-items>
<NcActionButton @click="openReport">
<template #icon><ChartBar :size="20" /></template>
Export report
</NcActionButton>
</template>
</CnActionsBar>

Props

PropTypeDefaultDescription
paginationObjectnullPagination state { total, page, pages, limit } — used to render "Showing X of Y"
objectCountNumber0Number of currently visible items
selectableBooleantrueWhether rows/cards can be selected
selectedIdsArray[]Currently selected item IDs — controls disabled state of mass actions
addLabelString'Add'Label for the primary Add button
addIconString''MDI icon name for the Add button (falls back to Plus)
showAddBooleantrueWhether to show the Add button
addDisabledBooleanfalseWhether the Add button is disabled
viewModeString'table'Current view mode: 'table' or 'cards'
showViewToggleBooleantrueWhether to show the Cards/Table toggle (each option carries a leading icon)
cardsLabelString''Label for the cards/grid view-toggle option (defaults to "Cards")
tableLabelString''Label for the table/list view-toggle option (defaults to "Table")
cardsIconString''MDI icon name for the cards option (defaults to the built-in grid icon); resolved via CnIcon
tableIconString''MDI icon name for the table option (defaults to the built-in list icon); resolved via CnIcon
showSearchBooleanfalseShow an inline search field on the left of the bar; emits search on input
searchValueString''Current value of the inline search field (controlled)
searchPlaceholderString''Placeholder / accessible label for the inline search field
refreshingBooleanfalseWhether a refresh is currently in progress
refreshDisabledBooleanfalseWhether the Refresh action is disabled
showMassImportBooleantrueWhether to show the Import action
showMassExportBooleantrueWhether to show the Export action
showMassCopyBooleantrueWhether to show the Copy selected action
showMassDeleteBooleantrueWhether to show the Delete selected action
inlineActionCountNumber2How many actions to show inline (rest go in overflow)
showRequestFeatureBooleanfalseShow a built-in "Request a feature" entry in the overflow (after Refresh + headerActions). Emits @request-feature; the host opens the CnSuggestFeatureModal

Events

EventPayloadDescription
addAdd button clicked
refreshRefresh action triggered
request-featureBuilt-in "Request a feature" overflow item clicked (only when showRequestFeature)
view-mode-change'table' | 'cards'View toggle changed
show-importImport action triggered
show-exportExport action triggered
show-copyCopy selected action triggered
show-deleteDelete selected action triggered

Slots

SlotScopeDescription
filtersInline filter controls rendered inside the bar, between the view toggle and the add/actions (e.g. a CnQuickFilterBar segmented toggle).
header-actionsExtra buttons placed after the Add button, before the overflow menu
action-itemsExtra NcActionButton items injected into the overflow menu
mass-actions{ count, selectedIds }Extra mass-action items at the bottom of the overflow menu

Set documentationUrl to add a Documentation entry to the overflow menu (just before Request a feature). It renders as a link that opens the URL in a new tab (target="_blank", rel="noopener noreferrer"); customise the wording with documentationLabel. Empty (the default) hides it. This mirrors the widget Actions menu's Documentation entry. CnIndexPage forwards its own documentationUrl / documentationLabel props here.

Reference (auto-generated)

The tables below are generated from the SFC source via vue-docgen-cli. They reflect what's actually in CnActionsBar.vue and update automatically whenever the component changes.

Props

NameTypeRequiredDefaultDescription
paginationobjectnullPagination state: { total, page, pages, limit }
objectCountnumber0Number of currently visible objects (for "Showing X of Y")
selectablebooleantrueWhether rows/cards can be selected
selectedIdsarray[]Currently selected IDs
addLabelstring() =&gt; t('nextcloud-vue', 'Add')Label for the Add button
addIconstring''MDI icon name for the Add button (e.g. 'AccountGroup'). Falls back to Plus icon.
inlineActionCountnumber0How many action buttons to show inline (rest go in overflow dropdown)
showMassImportbooleantrueWhether to show the built-in mass Import action
showMassExportbooleantrueWhether to show the built-in mass Export action
showMassCopybooleantrueWhether to show the built-in mass Copy action
showMassDeletebooleantrueWhether to show the built-in mass Delete action
viewModestring'table'Current view mode: 'table' or 'cards'
showViewTogglebooleantrueWhether to show the Cards/Table view toggle
cardsLabelstring''Label for the cards/grid view-toggle option (defaults to "Cards")
tableLabelstring''Label for the table/list view-toggle option (defaults to "Table")
cardsIconstring''MDI icon name for the cards option (defaults to the built-in grid icon). Resolved via CnIcon.
tableIconstring''MDI icon name for the table option (defaults to the built-in list icon). Resolved via CnIcon.
showSearchbooleanfalseWhether to show the inline search field on the left of the bar
searchValuestring''Current value of the inline search field (controlled)
searchPlaceholderstring''Placeholder / accessible label for the inline search field
refreshingbooleanfalseWhether the refresh action is currently in progress
refreshDisabledbooleanfalseWhether the refresh action is disabled (e.g. when required selections are missing)
addDisabledbooleanfalseWhether the Add button is disabled (e.g. when required selections are missing)
showAddbooleantrueWhether to show the Add button
showSidebarTogglebooleanfalseWhether to show the Search/Columns sidebar toggle button. Lets the index sidebar default to closed and be opened on demand.
sidebarOpenbooleanfalseCurrent open state of the sidebar (controls the toggle's pressed state).
headerActionsArray<{ id: string, label: string, icon?: string, disabled?: boolean }>[]Manifest-declared page-level actions rendered in the overflow dropdown between Refresh and the #action-items slot. Each entry is { id, label, icon?, disabled? }. The bar emits @header-action({ action: id, id }) on click; handler resolution happens upstream (CnIndexPage).
documentationUrlstring''When set, adds a Documentation entry to the overflow menu (after Refresh, before headerActions). Opens the URL in a new tab. Empty string hides the entry.
documentationLabelstring() =&gt; t('nextcloud-vue', 'Documentation')Label for the Documentation overflow entry.

Events

NamePayloadDescription
view-mode-changeUser clicked one of the view-mode toggle buttons (Cards / Table). Payload is the selected mode string.
toggle-sidebarUser clicked the Search/Columns sidebar toggle. No payload.
addUser clicked the primary Add button. No payload.
refreshUser clicked the Refresh entry in the overflow Actions menu. The host should re-fetch the underlying list.
header-actionUser clicked a manifest-declared page-level header action. Payload: { action: id, id }.
show-importUser clicked the Import mass action. Host should open the import modal.
show-exportUser clicked the Export mass action. Host should open the export modal.
show-copyUser clicked the Copy-selected mass action. Disabled while no row is selected.
show-deleteUser clicked the Delete-selected mass action. Disabled while no row is selected.
searchEmitted when the user types in the inline search field.

Slots

NameBindingsDescription
filtersfilters Inline filter controls rendered inside the action bar, between the view toggle and the add/actions (e.g. a CnQuickFilterBar segmented toggle).
actionsactions
action-itemsaction-items
mass-actionscount, selected-idsmass-actions

Additional props

PropTypeDefaultDescription
showSidebarToggleBooleanfalseWhether to show the Search/Columns sidebar toggle button (lets the index sidebar default to closed and open on demand).
sidebarOpenBooleanfalseCurrent open state of the sidebar (controls the toggle button's pressed state).