Blazor

How do you consume a Blazor component library?

How do you consume a Blazor component library?

You can consume a library in either of two ways:

  • Full name with namespace
  • Using Razor’s @using directive

If the MyComponentLib is the component library and MyComponent is the component name, those are consumed like in the following.

Option 1

<h1>Hello, world!</h1>

Welcome to your new app.

<MyComponentLib.MyComponent />

Option 2

@using MyComponent

<h1>Hello, world!</h1>

Welcome to your new app.

<MyComponent />

I would suggest you check the below link for better understanding:
https://docs.microsoft.com/en-in/aspnet/core/blazor/class-libraries#consume-a-library-component

Sumitra Kumari Shaw

An Engineering graduate who Enjoys building things that live on the internet.