Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/aeagle/blazor-book

A Storybook like UI for Blazor components
https://github.com/aeagle/blazor-book

blazor components layout net storybook ui wasm webassembly

Last synced: 2 months ago
JSON representation

A Storybook like UI for Blazor components

Awesome Lists containing this project

README

        

# blazor-book

A Storybook like UI for hosting Blazor components

## 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("<>"));`

- In `_Imports.razor`

Add `@using BlazorBook.Components`

- In `App.razor`

1. Add to the top
2. Add an AdditionalAssemblies prop on the component as follows:

```html

...

```

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")]

Hello @(world)!

@code {
string world = "World!";
}
```