Skip to content

Simple port of FluenUI/Office Fabric React components and style to Blazor

License

Notifications You must be signed in to change notification settings

supadmins/BlazorFluentUI

 
 

Repository files navigation

BlazorFluentUI

Simple port of Fluent UI (formerly Office Fabric) React components and style to Blazor

Client-side Demo (web assembly)

https://www.blazorfluentui.net/

Server-side Demo (SignalR)

https://blazorfluentui.azurewebsites.net/

Telegram dev channel

https://t.me/blazorfabric

See the wiki for all usage notes

https://github.com/BlazorFluentUI/BlazorFluentUI/wiki

Status of Controls

Basic Inputs

Control State Information
Button #107c10 Done
Checkbox #dff6dd Done except for icons
ChoiceGroup #a80000 ToDo
ComboBox #a80000 ToDo
Dropdown #107c10 Done
Label #107c10 Done
Link #107c10 Done
Rating #107c10 Done
SearchBox #a80000 ToDo
Slider #a80000 ToDo
SpinButton #a80000 ToDo
TextField #dff6dd Done except masking
Toggle #107c10 Done

Galleries & Pickers

Control State Information
Calendar #107c10 Done
ColorPicker #a80000 ToDo
DatePicker #107c10 Done
PeoplePicker #a80000 ToDo
Pickers #a80000 ToDo
SwatchColorPicker #a80000 ToDo

Items & Lists

Control State Information
ActivityItem #a80000 ToDo
DetailsList #107c10 Done
DocumentCard #a80000 ToDo
Facepile #a80000 ToDo
GroupedList #107c10 Done
HoverCard #a80000 ToDo
List #dff6dd Done supports INotifyCollectionChanged
Persona #107c10 Done

Commands, Menus & Navs

Control State Information
Breadcrumb #a80000 ToDo
CommandBar #107c10 Done
ContextualMenu #107c10 Done
Nav #107c10 Done
OverflowSet #107c10 Done
Pivot #107c10 Done

Notification & Engagement

Control State Information
Coachmark #a80000 ToDo
MessageBar #107c10 Done
TeachingBubble #a80000 ToDo

Progress

Control State Information
ProgressIndicator #107c10 Done
Shimmer #a80000 ToDo
Spinner #107c10 Done

Surfaces

Control State Information
Callout #107c10 Done
Dialog #dff6dd Done can't drag
Modal #dff6dd Done no modeless version
Panel #107c10 Done
ScrollablePane #a80000 ToDo
Tooltip #fff4ce In Progress limited functionality. will show, but can't interact with it yet, doesn't respond to overflow yet.

Utilities

Control State Information
Announced #a80000 ToDo
FocusTrapZone #107c10 Done
FocusZone #107c10 Done
Icon #dff6dd Done only MS icons
Image #107c10 Done
Keytips #a80000 ToDo
Layer #fff4ce In Progress only layers at root window right now.
MarqueeSelection #a80000 ToDo
Overlay #a80000 ToDo
ResizeGroup #107c10 Done
Selection #a80000 ToDo
Separator #a80000 ToDo
Stack #107c10 Done
Text #107c10 Done
Themes #a80000 ToDo

Non-Fabric-Component

Control State Information
ResponsiveLayout #107c10 Done
RichTextEditor #fff4ce In Progress Works with limited styles available
GlobalCS #fff4ce In Progress
LocalCS #fff4ce In Progress

Info

There are no MergeStyles in this port. It's just each control packaged into its own project so you can limit what gets added to your Blazor project.

To use

  1. Install NuGet package for the control you want. BlazorFluentUI.*
    (There is also a package that will install all packages at once: BlazorFluentUI.AllComponents
  2. Add the javascript to your index.html or index.cshtml file:
<script src="_content/BlazorFluentUI.BFUBaseComponent/blazorFluentUi.min.js"></script>
  1. Optionally, add Microsoft's assets package to your index.html or _Hosts.cshtml file.

<link rel="stylesheet" href="https://static2.sharepointonline.com/files/fabric/office-ui-fabric-core/11.0.0/css/fabric.min.css" />

OR

Use the tool here to generate your own MS font package: https://uifabricicons.azurewebsites.net/

(Remember that the assets package has a more restrictive license. You are required to use it with/for some type of Microsoft product. However, one of their engineers said that using it hosted on Azure would be enough... but I'm not a lawyer, so use caution.)

  1. Add "AddBlazorFluentUI" to ServiceProvider

ServerSide: Startup.cs

public void ConfigureServices(IServiceCollection services)
{
	...;
	services.AddBlazorFluentUI();
	...;
}

ClientSide from version 'Blazor WebAssembly 3.2.0' : Program.cs

public static async Task Main(string[] args)
{
	...;
	builder.Services.AddBlazorFluentUI();
	...;
}
  1. Add css-class tag in

ServerSide: Pages/_Host.cshtml

<head>
	...;
	<component type="typeof(GlobalRules)" render-mode="ServerPrerendered" />
	...;
</head>

ClientSide: wwwroot/index.html

<head>
	...;
	<style id="staticcs"></style>
	...;
</head>

You may need to add an @using BlazorFluentUI to the top of your _Hosts.cshmtl to avoid a 'GlobalRules could not be found` error.

  1. Add following to get controll over css-classes tag you created before

ServerSide: issn't needed

ClientSide from version 'Blazor WebAssembly 3.2.0' : Program.cs

public static async Task Main(string[] args)
{
	...;
	builder.RootComponents.Add<BFUGlobalRules>("#staticcs");
	...;
}
  1. For Theme's add following in App.razor as most outside Component. You can have a look in Demo application's App.razor
<BFUTheme>
	<...>
		<Router AppAssembly="typeof(Startup).Assembly" />
	</...>
</BFUTheme>
  1. If you're using any component that requires a Layer as part of its inner-workings (i.e. BFUModal, BFUCallout, BFUTooltip, etc... anything that pops up over already drawn stuff), you need to wrap the Router with a LayerHost.
<BFULayerHost Style="display:flex; flex-direction: row;width:100vw">
    <Router AppAssembly="typeof(Startup).Assembly" />
</BFULayerHost>

About

Simple port of FluenUI/Office Fabric React components and style to Blazor

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 72.2%
  • HTML 10.4%
  • TypeScript 8.5%
  • JavaScript 7.8%
  • CSS 1.1%