Skip to main content

CnActionsMenu

CnActionsMenu is the shared overflow Actions menu that renders the canonical built-in action trio used across every Conduction surface:

  1. Refresh
  2. Documentation (only when a documentationUrl is supplied)
  3. Request a feature

It also auto-mounts the CnSuggestFeatureModal for the Request-a-feature default. It's used internally by CnWidgetWrapper (per-widget menu) and by the page-level headers of CnDetailPage and CnDashboardPage, so widgets and pages stay in lockstep. CnActionsBar (list pages) mirrors the same items inline.

Most apps never instantiate CnActionsMenu directly — they configure it through the host component's props (documentation-url, show-refresh, show-request-feature, …). Reach for it directly only when building a new surface that needs the same trio.

Behaviour

  • Refresh — emits @refresh with { widgetId, title }. Unless a host listener calls event.preventDefault() on the second handler argument, it then emits on the @nextcloud/event-bus channel named by refreshChannel (cn:widget:refresh for widgets, cn:page:refresh for pages).
  • Documentation — rendered as an NcActionLink only when documentationUrl is non-empty. Opens the link in a new tab (target="_blank" + rel="noopener noreferrer"); there is no JS handler.
  • Request a feature — emits @request-feature with { widgetId, title }, then (unless suppressed) opens CnSuggestFeatureModal with app + page + surface context auto-filled from the cnAppId / cnFeatureRequestRepo injects provided by CnAppRoot. Without a resolvable repo it logs a one-line console.warn and skips opening.

The overflow trigger hides itself entirely when no built-in item is visible and no #action-items slot content is supplied.

The data-testids are derived from testidBase: <base>-actions (container), <base>-action-refresh, <base>-action-documentation, <base>-action-request-feature. Each host passes its own base (e.g. cn-widget-wrapper, cn-detail-page).

Usage

<CnActionsMenu
:widget-id="resolvedId"
:title="title"
:surface="`detail:${resolvedId}`"
:documentation-url="documentationUrl"
refresh-channel="cn:page:refresh"
testid-base="cn-detail-page"
@refresh="onRefresh"
@request-feature="onRequestFeature">
<template #action-items>
<NcActionButton @click="…">Custom action</NcActionButton>
</template>
</CnActionsMenu>

Slots

SlotDescription
action-itemsAdditional NcActionButton-family items appended inside the overflow menu, after the built-in Refresh / Documentation / Request-a-feature group.

Labels & state props

PropDefaultDescription
documentationLabelt('Documentation')Pre-translated label for the Documentation item.
refreshLabelt('Refresh')Pre-translated label for the Refresh item.
requestFeatureLabelt('Request a feature')Pre-translated label for the Request-a-feature item.
actionsMenuLabelt('Actions')Pre-translated aria-label / tooltip for the overflow trigger.
refreshingfalseWhen bound, the Refresh icon spins while true.
optimisticSpinMs800Optimistic Refresh-icon spin duration when refreshing is unbound.
specRef''Forwarded to the auto-mounted CnSuggestFeatureModal.

Reference (auto-generated)

The table below is generated from the SFC source via vue-docgen-cli and updates automatically whenever the component changes.

Props

NameTypeRequiredDefaultDescription
showRefreshbooleantrueWhether the Refresh item renders. The parent surface is responsible for any opt-out aliasing (e.g. CnWidgetWrapper's hideRefresh) and passes the resolved boolean here.
showRequestFeaturebooleantrueWhether the Request-a-feature item renders.
documentationUrlstring''Documentation link target. When a non-empty URL is provided the menu renders a "Documentation" item that opens the link in a new tab (target="_blank" + rel="noopener noreferrer"). Empty (the default) hides the item entirely.
documentationLabelstring() =&gt; t('nextcloud-vue', 'Documentation')Pre-translated label for the Documentation item. Defaults to the lib's translation of "Documentation".
widgetIdstring''Stable id forwarded on the @refresh / @request-feature payloads (as widgetId) and on the cn:widget:refresh event-bus payload. The parent resolves it (explicit id or slugified title).
titlestring''Human-readable title carried on action payloads.
surfacestring''Full surface string forwarded to the auto-mounted CnSuggestFeatureModal so the resulting GitHub issue records where the request originated (e.g. widget:&lt;id&gt;, detail:&lt;id&gt;, dashboard:&lt;id&gt;).
specRefstring''Optional specRef forwarded to the auto-mounted CnSuggestFeatureModal so the issue links to the spec capability this surface belongs to.
refreshingbooleanfalseWhether a refresh is currently in flight. When bound by the host, the Refresh icon spins for exactly as long as this stays true. When left false, clicking Refresh spins optimistically for optimisticSpinMs.
optimisticSpinMsnumber800Duration (ms) of the optimistic spin shown on Refresh click when the host has NOT bound :refreshing. Set to 0 to disable.
refreshChannelstring'cn:widget:refresh'Event-bus channel the default Refresh handler emits on when no host listener suppresses it. Widgets use cn:widget:refresh; page surfaces pass cn:page:refresh.
refreshLabelstring() =&gt; t('nextcloud-vue', 'Refresh')Pre-translated label for the Refresh action.
requestFeatureLabelstring() =&gt; t('nextcloud-vue', 'Request a feature')Pre-translated label for the Request-a-feature action.
actionsMenuLabelstring() =&gt; t('nextcloud-vue', 'Actions')Pre-translated aria-label / tooltip for the overflow trigger.
testidBasestring'cn-actions-menu'Prefix for the data-testids emitted on the menu container and its items: &lt;base&gt;-actions (container), &lt;base&gt;-action-refresh, &lt;base&gt;-action-documentation, &lt;base&gt;-action-request-feature. Lets each host keep its own stable testids.

Events

NamePayloadDescription
refreshundefinedUser clicked the Refresh item. Payload: { widgetId, title }. Handlers may call the second arg's preventDefault() to suppress the built-in default (event-bus emit on refreshChannel).
request-featureundefinedUser clicked the Request a feature item. Payload: { widgetId, title }. Handlers may call the second arg's preventDefault() to suppress the built-in default (auto-opening CnSuggestFeatureModal).

Slots

NameBindingsDescription
action-itemsaction-items Additional NcActionButton-family items