build-mvc-widgets
Installation
SKILL.md
Building ABP MVC / Razor Pages Widgets
A widget is an ASP.NET Core ViewComponent extended by ABP so it can carry its own script & style dependencies, participate in the bundling and authorization systems, and be refreshed (server- or client-side) from a dashboard. The payoff is the non-obvious part: a page that renders a widget never has to include the widget's JS/CSS or its transitive libraries — the widget declares them and ABP injects them. Types live in Volo.Abp.AspNetCore.Mvc.UI.Widgets.
When to Use
- You have (or want) a ViewComponent that owns script/style files and should not force consumers to manage those dependencies.
- You are building a dashboard: multiple widgets refreshed together, driven by a shared filter form.
- A widget must reload from the server (
RefreshUrl) or update itself client-side from a JSON payload. - A widget should only render for authenticated/authorized users.
Workflow
1. Make a ViewComponent and mark it [Widget]
Start from a normal ViewComponent (inheriting AbpViewComponent is optional — plain ViewComponent works; AbpViewComponent just adds base properties). Add [Widget] to register it: