🎓 All Courses | 📚 Blazor WASM Syllabus
Stickipedia University
📋 Study this course on TaskLoco

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.

Creating a Layout

// MainLayout.razor
@inherits LayoutComponentBase

<div class="page">
    <nav><NavMenu /></nav>
    <main>
        <article>@Body</article>
    </main>
    <footer>My App</footer>
</div>

Setting the Default Layout

<Router AppAssembly="@typeof(App).Assembly">
    <Found Context="routeData">
        <RouteView RouteData="routeData"
                   DefaultLayout="typeof(MainLayout)" />
    </Found>
</Router>

Per-Page Layout Override

@page "/login"
@layout BlankLayout

<h1>Login</h1>

Nested Layouts

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.


YouTube • Top 10
Blazor WASM: Layouts
Tap to Watch ›
📸
Google Images • Top 10
Blazor WASM: Layouts
Tap to View ›

Reference:

Wikipedia: Page Layout

image for linkhttps://en.wikipedia.org/wiki/Page_layout

📚 Blazor WASM — Full Course Syllabus
📋 Study this course on TaskLoco

TaskLoco™ — The Sticky Note GOAT