BlazorBook 0.0.1-beta.4
dotnet add package BlazorBook --version 0.0.1-beta.4
NuGet\Install-Package BlazorBook -Version 0.0.1-beta.4
<PackageReference Include="BlazorBook" Version="0.0.1-beta.4" />
paket add BlazorBook --version 0.0.1-beta.4
#r "nuget: BlazorBook, 0.0.1-beta.4"
// Install BlazorBook as a Cake Addin #addin nuget:?package=BlazorBook&version=0.0.1-beta.4&prerelease // Install BlazorBook as a Cake Tool #tool nuget:?package=BlazorBook&version=0.0.1-beta.4&prerelease
blazor-book
A Storybook like UI for hosting Blazor components
<img src="https://www.allaneagle.com/blazorbook.gif?v=1" width="100%" />
Installation
The BlazorBook
nuget package needs to be added to your Blazor WASM/Server app and your Razor Class library project containing your individual stories.
Install-Package BlazorBook -ProjectName MyProject
Setup
In the startup of your Blazor WASM/Server app:
app.RegisterAllStories(Assembly.Load("<<Assembly name containing stories>>"));
- In
_Imports.razor
Add @using BlazorBook.Components
In
App.razor
- Add <BlazorBook.Resources /> to the top
- Add an AdditionalAssemblies prop on the <Router /> component as follows:
<Router
AppAssembly="@typeof(App).Assembly"
AdditionalAssemblies="new[] { typeof(BlazorBook.UI).Assembly }"
>
...
</Router>
The stories will be registered and the UI available on the path /blazorbook
Stories
Create a Razor Class Library to contain your stories. This should also have the BlazorBook
nuget package as a dependency.
For example a story can be as follows:
HelloWorld.razor
@inherits BlazorBook.StoryComponent
@attribute [DisplayName("Story name")]
<div>Hello @(world)!</div>
@code {
string world = "World!";
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- BlazorSpaces (>= 0.0.1-beta.2)
- Microsoft.AspNetCore.Components.Web (>= 8.0.4)
- Microsoft.AspNetCore.Components.WebAssembly (>= 8.0.4)
- Newtonsoft.Json (>= 13.0.3)
- System.Net.Http.Json (>= 8.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.0.1-beta.4 | 348 | 9/25/2024 |
0.0.1-beta.3 | 84 | 4/23/2024 |
0.0.1-beta.2 | 1,136 | 2/28/2023 |
0.0.1-beta.1 | 157 | 8/13/2022 |