Ga naar hoofdinhoud

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.
refreshingfalseWhile true, the Refresh item is disabled and shows a loading spinner — for exactly as long as this stays true, so it reflects the real refresh time.
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''Explicit documentation link target, opened in a new tab. Wins over the cnDocumentationBaseUrl + docsAnchor pair. Leave empty (the default) to let the menu build the per-widget deep-link itself.
docsAnchorstring''This surface's own section in the app's documentation, appended to the app-wide cnDocumentationBaseUrl. A bare slug (open-cases) becomes a #fragment; a value starting with / is resolved as a path; a full scheme:// URL is used as written. Supplying it is what makes the Documentation item land on THIS widget's section rather than the docs homepage.
showDocumentationbooleantrueWhether the Documentation item renders. Defaults to true — the canonical trio is meant to be present on every surface; set false only where a docs link genuinely cannot exist.
showReportBugbooleantrueWhether the "Report a bug" item renders.
reportBugUrlstring''Explicit "Report a bug" target. Empty (the default) builds a new-issue deep-link on the app's forge from the injected cnFeatureRequestRepo + cnFeatureRequestForge, pre-filled with the surface's title.
reportBugLabelstring() =&gt; t('nextcloud-vue', 'Report a bug')Pre-translated label for the Report-a-bug action.
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. While true, the Refresh item is disabled and shows a loading spinner for exactly as long as this stays true — so the spinner reflects the real refresh time.
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-request-feature, &lt;base&gt;-action-report-bug, &lt;base&gt;-action-documentation. 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-items—action-items Additional NcActionButton-family items

The mandatory trio​

Request a feature, Report a bug and Documentation render on every surface. None of them is conditional on a URL being configured: the menu resolves each target itself, so a host that passes nothing still gets all three. That is the point — the items used to be per-host markup, and OpenRegister's widget menus shipped without the Documentation entry while OpenCatalogi's were inconsistent.

PropDefaultDescription
docsAnchor''This surface's own section in the app's documentation, appended to the app-wide base. A bare slug (open-cases) becomes a #fragment; a value starting with / is resolved as a path; a full scheme:// URL is used as written. Supplying it per widget is what makes the docs link land on that widget's section instead of the docs homepage.
showDocumentationtrueWhether the Documentation item renders. For the rare surface that must suppress it deliberately.
showReportBugtrueWhether the Report-a-bug item renders.
reportBugUrl''Explicit bug-report target. Empty builds a new-issue deep-link on the app's own forge from the injected cnFeatureRequestRepo / cnFeatureRequestForge, pre-filled with the surface's title.
reportBugLabelt('Report a bug')Pre-translated label for the Report-a-bug item.

The target is resolved in this order:

  1. the documentationUrl prop, if set (deep-linked with docsAnchor when both are given);
  2. the app-wide cnDocumentationBaseUrl provided by CnAppRoot, plus docsAnchor;
  3. the app's conventional docs site derived from cnAppId — a last resort so the item is never simply missing.

An app that hosts its docs anywhere else should provide cnDocumentationBaseUrl rather than pass a URL per widget.