Skip to content
This repository was archived by the owner on Dec 7, 2025. It is now read-only.

carlosga/blatternfly

Repository files navigation

Build Status GitHub last commit GitHub Nuget version Nuget downloads

Blatternfly

!! This repository has moved !!

View demo

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>

License

Distributed under the MIT License. See LICENSE for more information.

Acknowledgements