Skip to content

Commit

Permalink
Component namespaces for custom folders (dotnet#18245)
Browse files Browse the repository at this point in the history
  • Loading branch information
guardrex authored May 11, 2020
1 parent c0e23c1 commit d40ef2d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions aspnetcore/blazor/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,20 @@ Typically, a component's namespace is derived from the app's root namespace and
* The `Counter` component's namespace is `BlazorApp.Pages`.
* The fully qualified type name of the component is `BlazorApp.Pages.Counter`.

For more information, see the [Import components](#import-components) section.

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`:
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:

```razor
@using BlazorApp.Components
```

Alternatively, a component can be directly referenced:

```razor
<BlazorApp.Components.MyCoolComponent />
```

For more information, see the [Import components](#import-components) section.

## Static assets

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).
Expand Down

0 comments on commit d40ef2d

Please sign in to comment.