Skip to content

Blatternfly is a Blazor implementation of PatternFly

License

Notifications You must be signed in to change notification settings

carlosga/blatternfly

Folders and files

NameName
Last commit message
Last commit date

Latest commit

752b99c · Oct 7, 2022
Apr 16, 2022
Oct 7, 2022
Oct 7, 2022
Aug 7, 2022
Jul 19, 2021
Apr 16, 2022
Sep 28, 2022
Sep 28, 2022
Jan 14, 2022
Jul 12, 2022
Aug 12, 2021

Repository files navigation

Build Status GitHub last commit GitHub Nuget version Nuget downloads

Blatternfly

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