Reputation: 97
Is it possible to display only specific component in Blazor? I dont want to display/show main menu or login button on the top. ONLY content of a particulate component. For example: show only 'Weather forecast' table when user navigates to a specific URL without showing any shared components like MainLayout or NavMenu.
Upvotes: 1
Views: 932
Reputation: 273179
Blazor uses a default layout, it is Shared\MainLayout.razor
In there you can see how the menu and top row are setup.
First, define your own minimalist layout:
Shared\ClearLayout.razor
@inherits LayoutComponentBase
<div class="page">
@Body
</div>
And then add 1 line to the top of FetchData.razor
:
@page "/fetchdata"
@layout ClearLayout
<PageTitle>Weather forecast</PageTitle>
...
Upvotes: 3