Skip to content

Commit d40ef2d

Browse files
authored
Component namespaces for custom folders (#18245)
1 parent c0e23c1 commit d40ef2d

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

aspnetcore/blazor/components.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,20 @@ Typically, a component's namespace is derived from the app's root namespace and
5050
* The `Counter` component's namespace is `BlazorApp.Pages`.
5151
* The fully qualified type name of the component is `BlazorApp.Pages.Counter`.
5252

53-
For more information, see the [Import components](#import-components) section.
54-
55-
To use a custom folder, add the custom folder's namespace to either the parent component or to the app's *_Imports.razor* file. For example, the following namespace makes components in a *Components* folder available when the app's root namespace is `BlazorApp`:
53+
For custom folders that hold components, add a `using` statement to the parent component or to the app's *_Imports.razor* file. The following example makes components in the *Components* folder available:
5654

5755
```razor
5856
@using BlazorApp.Components
5957
```
6058

59+
Alternatively, a component can be directly referenced:
60+
61+
```razor
62+
<BlazorApp.Components.MyCoolComponent />
63+
```
64+
65+
For more information, see the [Import components](#import-components) section.
66+
6167
## Static assets
6268

6369
Blazor follows the convention of ASP.NET Core apps placing static assets under the project's [web root (wwwroot) folder](xref:fundamentals/index#web-root).

0 commit comments

Comments
 (0)