You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: aspnetcore/blazor/project-structure.md
+70-2Lines changed: 70 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,17 +32,52 @@ More information on components and render modes is found in the <xref:blazor/com
32
32
33
33
Based on the interactive render mode selected at app creation, the `Layout` folder is either in the server project in the `Components` folder or at the root of the `.Client` project. The folder contains the following layout components and stylesheets:
34
34
35
+
:::moniker-end
36
+
37
+
:::moniker range=">= aspnetcore-10.0"
38
+
39
+
* The `MainLayout` component (`MainLayout.razor`) is the app's [layout component](xref:blazor/components/layouts).
40
+
* The `MainLayout.razor.css` is the collocated (next to the component) stylesheet for the app's main layout.
41
+
* The `NavMenu` component (`NavMenu.razor`) implements sidebar navigation. The component includes [`NavLink` components](xref:blazor/fundamentals/routing#navlink-component) (<xref:Microsoft.AspNetCore.Components.Routing.NavLink>), which render navigation links to other Razor components. The <xref:Microsoft.AspNetCore.Components.Routing.NavLink> component indicates to the user which component is currently displayed.
42
+
* The `NavMenu.razor.css` is the collocated stylesheet for the app's navigation menu.
43
+
* The `ReconnectModal` component reflects the server-side connection state in the UI and is included when the app's interactive render mode is either Interactive Server or Interactive Auto. For more information, see <xref:blazor/fundamentals/signalr#reflect-the-server-side-connection-state-in-the-ui>.
44
+
* The `ReconnectModal.razor.css` is the collocated stylesheet for the `ReconnectModal` component.
45
+
* The `ReconnectModal.razor.css` is the collocated JavaScript file for the `ReconnectModal` component.
* The `MainLayout` component (`MainLayout.razor`) is the app's [layout component](xref:blazor/components/layouts).
36
-
* The `MainLayout.razor.css` is the stylesheet for the app's main layout.
52
+
* The `MainLayout.razor.css` is the collocated (next to the component) stylesheet for the app's main layout.
37
53
* The `NavMenu` component (`NavMenu.razor`) implements sidebar navigation. The component includes [`NavLink` components](xref:blazor/fundamentals/routing#navlink-component) (<xref:Microsoft.AspNetCore.Components.Routing.NavLink>), which render navigation links to other Razor components. The <xref:Microsoft.AspNetCore.Components.Routing.NavLink> component indicates to the user which component is currently displayed.
38
-
* The `NavMenu.razor.css` is the stylesheet for the app's navigation menu.
54
+
* The `NavMenu.razor.css` is the collocated stylesheet for the app's navigation menu.
55
+
56
+
:::moniker-end
57
+
58
+
:::moniker range=">= aspnetcore-8.0"
39
59
40
60
The `Routes` component (`Routes.razor`) is either in the server project or the `.Client` project and sets up routing using the <xref:Microsoft.AspNetCore.Components.Routing.Router> component. For client-side interactive components, the <xref:Microsoft.AspNetCore.Components.Routing.Router> component intercepts browser navigation and renders the page that matches the requested address.
41
61
42
62
The `Components` folder of the server project holds the app's server-side Razor components. Shared components are often placed at the root of the `Components` folder, while layout and page components are usually placed in folders within the `Components` folder.
43
63
44
64
The `Components/Pages` folder of the server project contains the app's routable server-side Razor components. The route for each page is specified using the [`@page`](xref:mvc/views/razor#page) directive.
The `NotFound` component (`NotFound.razor`) implements a Not Found page to display when content isn't found for a request path. For more information, see xref:blazor/fundamentals/navigation#not-found-responses.
76
+
77
+
:::moniker-end
78
+
79
+
-->
80
+
46
81
The `App` component (`App.razor`) is the root component of the app with HTML `<head>` markup, the `Routes` component, and the Blazor `<script>` tag. The root component is the first component that the app loads.
47
82
48
83
An `_Imports.razor` file in each of the server and `.Client` projects includes common Razor directives for Razor components of either project, such as [`@using`](xref:mvc/views/razor#using) directives for namespaces.
@@ -290,11 +325,44 @@ Project structure:
290
325
*`NavMenu` component (`NavMenu.razor`): Implements sidebar navigation. Includes the [`NavLink` component](xref:blazor/fundamentals/routing#navlink-component) (<xref:Microsoft.AspNetCore.Components.Routing.NavLink>), which renders navigation links to other Razor components. The <xref:Microsoft.AspNetCore.Components.Routing.NavLink> component automatically indicates a selected state when its component is loaded, which helps the user understand which component is currently displayed.
291
326
*`NavMenu.razor.css`: Stylesheet for the app's navigation menu.
* `Pages` folder: Contains the Blazor app's routable Razor components (`.razor`). The route for each page is specified using the [`@page`](xref:mvc/views/razor#page) directive. The template includes the following components:
340
+
* `Counter` component (`Counter.razor`): Implements the Counter page.
341
+
* `Index` component (`Index.razor`): Implements the Home page.
342
+
* `Weather` component (`Weather.razor`): Implements the Weather page.
343
+
* `NotFound` component (`NotFound.razor`) Implements a Not Found page to display when content isn't found for a request path. For more information, see xref:blazor/fundamentals/navigation#not-found-responses.
*`Pages` folder: Contains the Blazor app's routable Razor components (`.razor`). The route for each page is specified using the [`@page`](xref:mvc/views/razor#page) directive. The template includes the following components:
294
352
*`Counter` component (`Counter.razor`): Implements the Counter page.
295
353
*`Index` component (`Index.razor`): Implements the Home page.
296
354
*`Weather` component (`Weather.razor`): Implements the Weather page.
*`_Imports.razor`: Includes common Razor directives to include in the app's components (`.razor`), such as [`@using`](xref:mvc/views/razor#using) directives for namespaces.
299
367
300
368
*`App.razor`: The root component of the app that sets up client-side routing using the <xref:Microsoft.AspNetCore.Components.Routing.Router> component. The <xref:Microsoft.AspNetCore.Components.Routing.Router> component intercepts browser navigation and renders the page that matches the requested address.
0 commit comments