
Layouts in Blazor are special components that define a shared page shell — navigation, sidebar, header, footer — with a @Body placeholder where routable page content renders.
// MainLayout.razor
@inherits LayoutComponentBase
<div class="page">
<nav><NavMenu /></nav>
<main>
<article>@Body</article>
</main>
<footer>My App</footer>
</div><Router AppAssembly="@typeof(App).Assembly">
<Found Context="routeData">
<RouteView RouteData="routeData"
DefaultLayout="typeof(MainLayout)" />
</Found>
</Router>@page "/login"
@layout BlankLayout
<h1>Login</h1>Layouts can inherit from other layouts, enabling nested shell structures — useful for apps with sections that have their own sub-navigation such as an admin area.
Reference:
TaskLoco™ — The Sticky Note GOAT