Ga naar hoofdinhoud

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, NcCheckboxRadioSwitch

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
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)

Events

EventPayloadDescription
addAdd button clicked
refreshRefresh action triggered
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
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

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
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

Events

NamePayloadDescription
view-mode-change
add
refresh
show-import
show-export
show-copy
show-delete

Slots

NameBindingsDescription
actions
action-items
mass-actionscount, selected-ids