Quick Start Simple Dashboards v17
Install Package
Section titled “Install Package”dotnet add package Umbraco.Community.SimpleDashboardsRegister Dashboard
Section titled “Register Dashboard”By default this will display in the content section for Admins only.
using Umbraco.Community.SimpleDashboards.Web;public class BasicDashboard : SimpleDashboard { }Create View
Section titled “Create View”- Your view must go in
/Views/Dashboard - You view must be the name of your C# class (without
Dashboard)- For example:
BasicDashboard.cs=>/Views/Dashboard/Basic.cshtml
- For example:
@inherits Umbraco.Community.SimpleDashboards.DashboardViewPage
<uui-box headline="Hello Umbraco"> <p>My Dashboard is: @Model.Dashboard.Alias</p></uui-box>Detailed Register Dashboard
Section titled “Detailed Register Dashboard”By adding a constructor you can define permissions, where to display and the name of the dashboard.
using Umbraco.Community.SimpleDashboards.Web;
public class ExampleDashboard : SimpleDashboard{ public override string Name => "Example Dashboard";
public override int Weight => 500;
// Show dashboard in the Media section public override string[] Sections => ["Umb.Section.Media", "Umb.Section.Content"];}View Component Example
Section titled “View Component Example”- Your View Component should match the name of your C# class plus
ViewComponent.cs- For example:
BasicDashboard.cs=>BasicDashboardViewComponent.cs
- For example:
- Your View Component must inherit either:
DashboardViewComponentDashboardAsyncViewComponent
public class ExampleDashboardViewComponent : DashboardAsyncViewComponent{ public override Task<IViewComponentResult> InvokeAsync(DashboardViewModel model) { // Complex business logic var viewModel = await _service.CreateViewModel(model); // ... return View("~/Views/MyPath/MyView.cshtml", viewModel); }}