Skip to main content

CnWidgetRenderer

Fetches and renders Nextcloud Dashboard API widgets (v1 and v2) using NcDashboardWidget. Handles loading state, empty content, and optional auto-refresh. Used internally by CnDashboardPage for NC-native widgets.

Wraps: NcDashboardWidget, NcEmptyContent

Try it

Loading CnWidgetRenderer playground…

Usage

<!-- In a CnDashboardPage widget slot (handled automatically) -->
<CnWidgetRenderer :widget="ncWidget" />

<!-- Standalone with custom unavailable text -->
<CnWidgetRenderer
:widget="calendarWidget"
unavailable-text="Calendar widget not available" />

The widget object typically comes from the Nextcloud Dashboard API (/ocs/v2.php/apps/dashboard/api/v1/widgets):

// Example NC widget object
const widget = {
id: 'calendar',
title: 'Calendar',
iconClass: 'icon-calendar',
widgetUrl: '/apps/calendar',
itemIconsRound: false,
itemApiVersions: [2], // triggers v2 item fetching
reloadInterval: 300, // auto-refresh every 5 minutes
}

Props

PropTypeRequiredDescription
widgetObjectNextcloud Dashboard API widget object. Must have id and itemApiVersions for API fetching
unavailableTextString'Widget not available' — shown when the widget type is not recognized

Widget API versions

itemApiVersions containsBehavior
2Fetches from /apps/dashboard/api/v2/widget-items
1Fetches from /apps/dashboard/api/v1/widget-items
neitherShows the unavailable fallback

Reference (auto-generated)

The tables below are generated from the SFC source via vue-docgen-cli. They reflect what's actually in CnWidgetRenderer.vue and update automatically whenever the component changes.

Props

NameTypeRequiredDefaultDescription
widget{ id: string, title: string, iconClass: string, iconUrl: string, widgetUrl: string, itemIconsRound: boolean, itemApiVersions: number[], reloadInterval: number, buttons: Array }Nextcloud widget object from the Dashboard API.
unavailableTextstring'Widget not available'Text shown when widget is not available