Ga naar hoofdinhoud

CnBannerWidget

A notice for dashboards and pages. It renders a themed note card with a severity, a text, an optional click-through route and an optional visibleWhen condition. With layout: "attention" it renders an attention card: a card with a severity edge, a kicker, a title, a reason line and actions.

The widget registers itself as the banner dashboard widget type, so a manifest places it with widgetKey: "banner". It is also a named export, for an app component that draws the card itself and passes the props directly:

import { CnBannerWidget } from '@conduction/nextcloud-vue'

Before this export existed, a named import resolved to undefined. Vue then rendered an unknown <cnbannerwidget> element and the grid kept an empty cell for it. An app that cannot import it yet can read the same component from the widget registry with getWidgetTypeEntry('banner').renderer.

For the manifest keys and the attention card see the dashboard widget catalog.

Props​

PropTypeDescription
variant'info' | 'warning' | 'error' | 'success'The severity. Empty falls back to content, then info.
textstringThe banner text. Empty falls back to content.
leadstringA bold lead before the text; {value} is filled like in text, and it goes through the app's translate (as text does). Empty falls back to content.
iconstringA named icon (AccountPlus, ...) drawn before the text instead of the variant's glyph. Empty falls back to content. Under the board look the first of actions is drawn as a link at the end of the line.
visibleWhenobject | nullThe visibility condition. null shows the banner always.
routestring | object | nullA route name or location. When set, the text is a link.
layout'' | 'banner' | 'attention'The note card (default) or the attention card.
kickerstringAttention card: the label above the title.
titlestringAttention card: the title. Falls back to text.
reasonstringAttention card: the line that says why it needs attention.
actionsArrayAttention card: the actions.
maxActionsnumber | nullAttention card: the most actions shown.
stackedbooleanAttention card: the actions under the text, with a 16px title.
contentobjectThe stored content blob; flat props win on collision.
conditionOutcomeobject | nullA verdict a host already evaluated, so the banner does not fetch again. Its row is the first row of an ordered visibleWhen.source, the card's subject ({subject.title} in the texts, @subject.id in an action route).

Events​

EventPayloadDescription
action{ id, label, index }An attention-card action with neither route nor href was clicked.

Reference (auto-generated)​

OpenRegister reliance​

light: this component touches OpenRegister lightly. 0 direct references, 3 files reached through imports.

See the reliance overview for the filterable list.

Props​

NameTypeRequiredDefaultDescription
variantstring''Banner severity variant: info | warning | error (plus success for completeness — NcNoteCard's set). Empty falls back to the content blob, then info.
textstring''Pre-translated banner text. Empty falls back to the content blob.
leadstring''A bold lead in front of the text ("2 aanmeldingen wachten op goedkeuring." before the rest of the sentence). {value} is replaced like in text, and it goes through the app's translate. Empty falls back to the content blob.
iconstring''A named icon (AccountPlus, AlertOutline, ...) drawn before the text instead of the variant's own glyph. Empty falls back to the content blob, then to the variant glyph.
visibleWhenunionnullOptional visibility condition. Shape: { endpoint?, source?, field?, op?, value } — exactly one of endpoint (a same-origin URL returning JSON) or source ({ register, schema, filter? }, an OpenRegister object query whose filter supports the shared @-token grammar). field is a dot-path into the response (for a source, into the first result; omit it — or use @total — to compare the collection total). op is eq | neq | gt | gte | lt | lte (default eq); value is the literal right-hand side. null (the default) shows the banner unconditionally.
routeunionnullOptional click-through route: a vue-router route NAME (string) or a full location object. When set, the banner text is a link to that route. null renders static text.
layoutstring''How the banner renders: banner (the note card, default) or attention (a card with a severity edge, kicker, title, reason and up to two actions). Empty falls back to the content blob, then banner.
kickerstring''Attention card: the small label above the title ("First today").
titlestring''Attention card: the title. Falls back to text when empty.
reasonstring''Attention card: the line under the title that says why this needs attention. {value} is replaced like in text.
actionsunionnullAttention card: its actions, two at most (four under the board look, or maxActions). Each is { label, route?, href?, primary?, id? }: route is a route name or location, href an URL. An action with neither renders a button that emits action. The first action is the primary one unless one sets primary: true.
maxActionsnumbernullAttention card: how many actions it shows at most. Null takes the default: two, four under the board look.
stackedbooleanfalseAttention card: stack the actions under the text instead of beside it, the "Begin hier" card of PqMijnWerk (16px title, the action under the reason). Falls back to the content blob.
contentobject\{\}Stored content blob (CnDashboardPage registry branch) carrying the same keys as the flat props: { variant, text, visibleWhen, route, layout, kicker, title, reason, actions }. Explicit flat props win on collision.
conditionOutcomeunionnullPre-evaluated visibleWhen outcome { met, value }, injected by a host that already ran the predicate (CnDashboardPage evaluates it to know whether to collapse the banner's grid cell). When present, the banner renders from this verdict instead of fetching again — no duplicate request and no hidden-until-self-evaluated flash — and value feeds the {value} text placeholder. null (the default) keeps the banner self-evaluating. A host whose request failed passes { met: false, value: null, failed: true, reason }, and an attention card then says it could not check.

Events​

NamePayloadDescription
action—Emitted when an attention-card action without a route or href is clicked, so the host can run it.