Dashboard Layout
Set up the ShellUI dashboard (sidebar, header, breadcrumb, theme toggle) as your app's layout with one command
ShellUI ships two dashboard layouts, each a sidebar plus a content area with a header, breadcrumb and theme toggle:
| Block | Header |
|---|---|
dashboard-02 |
Sticky: stays at the top while the page scrolls |
dashboard-01 |
Scrolls with the content |
Both are live on the Blocks page. In 0.4 the CLI makes the dashboard your app's layout for you. In 0.3 this took several manual steps; they are in the v0.3 guide.
Set it up
shellui init asks which layout you want. To choose without the prompt:
shellui init --dashboard 02
Use --dashboard 01 for the scrolling header, or --dashboard none to skip it. With --yes alone, no dashboard is added.
shellui add dashboard-02
Then run the app:
dotnet watch
Your pages render inside the dashboard. On desktop, Ctrl+B (Cmd+B on macOS) collapses and expands the sidebar; on small screens, the menu button in the header opens it.
What the CLI changes
Both commands install the files and wire them in:
| Change | Details |
|---|---|
| Adds the layout | Components/Layout/DashboardLayout02.razor, plus AppSidebar, the sidebar parts, Breadcrumb, Separator, ThemeToggle and Avatar in Components/UI |
| Makes it the default | Routes.razor gets DefaultLayout="typeof(Layout.DashboardLayout02)" |
| Builds the sidebar links | From your app's @page routes. Routes with parameters, /Account/*, /Error and /not-found are skipped |
| Removes the template layout | MainLayout, NavMenu and their .razor.css files are deleted, but only when they are unchanged from dotnet new blazor and nothing else uses them |
| Moves the error bar | Blazor's blazor-error-ui element moves from MainLayout into App.razor |
| Updates pinned pages | Pages with @layout MainLayout, such as the .NET 10 NotFound page, switch to the dashboard |
The command prints a summary of what it changed, and running it again is safe. ReconnectModal and your pages are otherwise left alone.
If the app uses a custom layout, or a MainLayout you have edited, the CLI asks before switching. Without a terminal, for example in CI, it leaves the layout alone and prints a hint. Pass --replace-layout to switch anyway. Edited files are never deleted.
Customize the sidebar
Components/UI/AppSidebar.razor is yours to edit: the brand ("My App"), the links and the footer. The links are a list in the file's @code block, one entry per page with a title, a path and an icon name:
private static readonly NavLink[] Links =
[
new("Home", "/", "home"),
new("Counter", "/counter", "counter"),
new("Weather", "/weather", "weather"),
new("Reports", "/reports", "page"),
];
The CLI fills this list from your pages the first time, while it still holds only the template's Home link. After that the list is yours: add an entry when you add a page. The link of the current page is highlighted automatically.
Only some pages
To keep your current layout as the default and use the dashboard on certain pages, answer No when the CLI asks to switch, then add a @layout directive to those pages:
@page "/reports"
@layout Layout.DashboardLayout02
Signed-in user
In an app that uses ASP.NET Core Identity, the sidebar footer shows Log in and Register, or the signed-in user and Log out. See Authentication.
Switching between 01 and 02
Run shellui add for the other block. Routes.razor and any @layout directives switch to it, and both layouts use the same AppSidebar.razor, so your links carry over.
Removing a dashboard
Run shellui remove dashboard-02 (or dashboard-01). It deletes the layout from Components/Layout and lists the files that still use it, usually Routes.razor: point their DefaultLayout or @layout at another layout. remove only deletes the components you name, so AppSidebar.razor and the sidebar parts stay; remove them with shellui remove app-sidebar (and the parts) if you no longer need them.