Creating a Razor class library
In our project, we create reusable components in the Shared
folder. These components can be reused by other components, such as layout components or NavMenu
.
We can also encapsulate Razor components in a separate library in the form of the Razor class library. The components in the Razor class library are not project-specific, so they can be used in any Blazor project. We can use them in Blazor Hybrid, Blazor WebAssembly, or Blazor Server apps.
In this book, we build Razor components using Bootstrap. There are many open source Razor class libraries built on top of Bootstrap in GitHub. Some of them are good enough for commercial product development. Here are some examples:
- BootstrapBlazor – https://github.com/dotnetcore/BootstrapBlazor
- Blazorise – https://github.com/Megabit/Blazorise
- Havit.Blazor – https://github.com/havit/Havit.Blazor/
These open source projects are built as Razor class libraries so that...