Blazor-blatternfly

[删除(380066935@qq.com或微信通知)]

carlosga/blatternfly: Blatternfly is a Blazor implementation of PatternFly (github.com)

WildGums/Blorc.PatternFly: Blazor wrappers for PatternFly (see https://www.patternfly.org/) (github.com)

Blatternfly

About The Project

Blazor learning project. Blatternfly is a Blazor implementation of PatternFly.

Built With

  • Blazor. Some parts of the form and input base components has been copied over from Blazor source code.
  • PatternFly.

Getting started

Prerequisites

  • .NET 6.0

Imports

Add the following to _Imports.razor

@using Blatternfly
@using Blatternfly.Components
@using Blatternfly.Layouts

Patternfly CSS

Add the following to index.html

<link href="_content/Blatternfly/patternfly.css" rel="stylesheet" />
<link href="_content/Blatternfly/patternfly-addons.css" rel="stylesheet" />

See also the getting started section on the PatternFly website for more details.

PatternFly Dark Theme

To dynamically enable/disable the dark theme use the ThemeProvider component, to set the dark theme as the default theme add the class pf-theme-dark to the <html> tag.

Configuration

Example of Blatternfly configuration in Program.cs

var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");

builder.Services.AddScoped(sp => new HttpClient
{
    BaseAddress = new Uri(builder.HostEnvironment.BaseAddress)
});

builder.AddBlatternfly();

var webhost = builder.Build();

await webhost.UseBlatternfly();
await webhost.RunAsync();

Trimming

Configure assembly trimming via XML files as explained here 'Customizing Trimming in .NET 5'.

<linker>
  <assembly fullname="Blatternfly">
    <type fullname="EventHandlers"                     preserve="all" />
    <type fullname="Blatternfly.Interop.MouseEvent"    preserve="all" />
    <type fullname="Blatternfly.Interop.KeyboardEvent" preserve="all" />
    <type fullname="Blatternfly.Interop.ResizeEvent"   preserve="all" />
  </assembly>
</linker>