CnActionsMenu
CnActionsMenu is the shared … overflow Actions menu that renders the canonical built-in action trio used across every Conduction surface:
- Refresh
- Documentation (only when a
documentationUrlis supplied) - 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
@refreshwith{ widgetId, title }. Unless a host listener callsevent.preventDefault()on the second handler argument, it then emits on the@nextcloud/event-buschannel named byrefreshChannel(cn:widget:refreshfor widgets,cn:page:refreshfor pages). - Documentation — rendered as an
NcActionLinkonly whendocumentationUrlis non-empty. Opens the link in a new tab (target="_blank"+rel="noopener noreferrer"); there is no JS handler. - Request a feature — emits
@request-featurewith{ widgetId, title }, then (unless suppressed) opensCnSuggestFeatureModalwithapp + page + surfacecontext auto-filled from thecnAppId/cnFeatureRequestRepoinjects provided byCnAppRoot. Without a resolvable repo it logs a one-lineconsole.warnand 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
| Slot | Description |
|---|---|
action-items | Additional NcActionButton-family items appended inside the overflow menu, after the built-in Refresh / Documentation / Request-a-feature group. |
Labels & state props
| Prop | Default | Description |
|---|---|---|
documentationLabel | t('Documentation') | Pre-translated label for the Documentation item. |
refreshLabel | t('Refresh') | Pre-translated label for the Refresh item. |
requestFeatureLabel | t('Request a feature') | Pre-translated label for the Request-a-feature item. |
actionsMenuLabel | t('Actions') | Pre-translated aria-label / tooltip for the overflow trigger. |
refreshing | false | While 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
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
showRefresh | boolean | true | Whether 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. | |
showRequestFeature | boolean | true | Whether the Request-a-feature item renders. | |
documentationUrl | string | '' | 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. | |
documentationLabel | string | () => t('nextcloud-vue', 'Documentation') | Pre-translated label for the Documentation item. Defaults to the lib's translation of "Documentation". | |
widgetId | string | '' | 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). | |
title | string | '' | Human-readable title carried on action payloads. | |
surface | string | '' | Full surface string forwarded to the auto-mounted CnSuggestFeatureModal so the resulting GitHub issue records where the request originated (e.g. widget:<id>, detail:<id>, dashboard:<id>). | |
specRef | string | '' | Optional specRef forwarded to the auto-mounted CnSuggestFeatureModal so the issue links to the spec capability this surface belongs to. | |
refreshing | boolean | false | Whether 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. | |
refreshChannel | string | '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. | |
refreshLabel | string | () => t('nextcloud-vue', 'Refresh') | Pre-translated label for the Refresh action. | |
requestFeatureLabel | string | () => t('nextcloud-vue', 'Request a feature') | Pre-translated label for the Request-a-feature action. | |
actionsMenuLabel | string | () => t('nextcloud-vue', 'Actions') | Pre-translated aria-label / tooltip for the overflow trigger. | |
testidBase | string | 'cn-actions-menu' | Prefix for the data-testids emitted on the menu container and its items: <base>-actions (container), <base>-action-refresh, <base>-action-documentation, <base>-action-request-feature. Lets each host keep its own stable testids. |
Events
| Name | Payload | Description |
|---|---|---|
refresh | undefined | User 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-feature | undefined | User 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
| Name | Bindings | Description |
|---|---|---|
action-items | — | action-items Additional NcActionButton-family items |