
Fluent UI Blazor
OfficialFreeIntegrate Fluent UI components in Blazor applications effortlessly.
Free · Opens the source repo
What Fluent UI Blazor does
The Fluent UI Blazor skill provides a comprehensive guide for developers looking to utilize the Microsoft Fluent UI Blazor component library in their Blazor applications. This library, encapsulated within the Microsoft.FluentUI.AspNetCore.Components NuGet package, offers a variety of UI components such as buttons, data grids, dialogs, and more, all designed to enhance the user experience in web applications. The skill outlines essential rules and best practices for implementing these components effectively, ensuring that developers can leverage the full potential of Fluent UI without unnecessary complications.
One of the key features of this skill is its emphasis on automatic loading of CSS and JavaScript, eliminating the need for manual script or link tags. This simplifies the setup process significantly, allowing developers to focus on building their applications rather than managing dependencies. Additionally, the skill highlights the importance of provider components, which must be included in the root layout to ensure that service-based components function correctly. This is crucial for avoiding silent failures that can hinder application performance.
The skill also provides detailed instructions on how to register services within the Program.cs file, manage icon usage through a separate NuGet package, and bind data to various components like FluentSelect and FluentAutocomplete. Each component's unique requirements are clearly outlined, helping developers avoid common pitfalls and ensuring a smoother development process. Furthermore, the skill addresses how to utilize dialog and toast services effectively, providing a robust framework for user interaction and notifications.
Overall, the Fluent UI Blazor skill is an invaluable resource for developers creating Blazor applications that require a modern and cohesive UI. By following the guidelines provided, users can ensure that their applications are not only functional but also visually appealing and user-friendly.
When to use it
Use this skill when developing Blazor applications that require Fluent UI components for a consistent and modern user interface.
When not to use it
This skill is not suitable for projects that do not involve Blazor or require a different UI framework.
What you can build with it
Building a New Blazor App
When starting a new Blazor application, use this skill to integrate Fluent UI components from the beginning for a modern UI.
Troubleshooting Component Issues
If you encounter issues with service-based components, this skill provides troubleshooting tips to resolve common problems.
Implementing Theming and Design Tokens
Use this skill to correctly implement theming and design tokens in your Blazor application after rendering.
How to install Fluent UI Blazor
View source1. Install with the skills CLI
npx skills add github/awesome-copilot/fluentui-blazor --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by githubFluent UI Blazor — Consumer Usage Guide
This skill teaches how to correctly use the Microsoft.FluentUI.AspNetCore.Components (version 4) NuGet package in Blazor applications.
Critical Rules
1. No manual <script> or <link> tags needed
The library auto-loads all CSS and JS via Blazor's static web assets and JS initializers. Never tell users to add <script> or <link> tags for the core library.
2. Providers are mandatory for service-based components
These provider components MUST be added to the root layout (e.g. MainLayout.razor) for their corresponding services to work. Without them, service calls fail silently (no error, no UI).
<FluentToastProvider />
<FluentDialogProvider />
<FluentMessageBarProvider />
<FluentTooltipProvider />
<FluentKeyCodeProvider />
3. Service registration in Program.cs
builder.Services.AddFluentUIComponents();
// Or with configuration:
builder.Services.AddFluentUIComponents(options =>
{
options.UseTooltipServiceProvider = true; // default: true
options.ServiceLifetime = ServiceLifetime.Scoped; // default
});
ServiceLifetime rules:
ServiceLifetime.Scoped— for Blazor Server / Interactive (default)ServiceLifetime.Singleton— for Blazor WebAssembly standaloneServiceLifetime.Transient— throwsNotSupportedException
4. Icons require a separate NuGet package
dotnet add package Microsoft.FluentUI.AspNetCore.Components.Icons
Usage with a @using alias:
@using Icons = Microsoft.FluentUI.AspNetCore.Components.Icons
<FluentIcon Value="@(Icons.Regular.Size24.Save)" />
<FluentIcon Value="@(Icons.Filled.Size20.Delete)" Color="@Color.Error" />
Pattern: Icons.[Variant].[Size].[Name]
- Variants:
Regular,Filled - Sizes:
Size12,Size16,Size20,Size24,Size28,Size32,Size48
Custom image: Icon.FromImageUrl("/path/to/image.png")
Never use string-based icon names — icons are strongly-typed classes.
5. List component binding model
FluentSelect<TOption>, FluentCombobox<TOption>, FluentListbox<TOption>, and FluentAutocomplete<TOption> do NOT work like <InputSelect>. They use:
Items— the data source (IEnumerable<TOption>)OptionText—Func<TOption, string?>to extract display textOptionValue—Func<TOption, string?>to extract the value stringSelectedOption/SelectedOptionChanged— for single selection bindingSelectedOptions/SelectedOptionsChanged— for multi-selection binding
<FluentSelect Items="@countries"
OptionText="@(c => c.Name)"
OptionValue="@(c => c.Code)"
@bind-SelectedOption="@selectedCountry"
Label="Country" />
NOT like this (wrong pattern):
@* WRONG — do not use InputSelect pattern *@
<FluentSelect @bind-Value="@selectedValue">
<option value="1">One</option>
</FluentSelect>
6. FluentAutocomplete specifics
- Use
ValueText(NOTValue— it's obsolete) for the search input text OnOptionsSearchis the required callback to filter options- Default is
Multiple="true"
<FluentAutocomplete TOption="Person"
OnOptionsSearch="@OnSearch"
OptionText="@(p => p.FullName)"
@bind-SelectedOptions="@selectedPeople"
Label="Search people" />
@code {
private void OnSearch(OptionsSearchEventArgs<Person> args)
{
args.Items = allPeople.Where(p =>
p.FullName.Contains(args.Text, StringComparison.OrdinalIgnoreCase));
}
}
7. Dialog service pattern
Do NOT toggle visibility of <FluentDialog> tags. The service pattern is:
- Create a content component implementing
IDialogContentComponent<TData>:
public partial class EditPersonDialog : IDialogContentComponent<Person>
{
[Parameter] public Person Content { get; set; } = default!;
[CascadingParameter] public FluentDialog Dialog { get; set; } = default!;
private async Task SaveAsync()
{
await Dialog.CloseAsync(Content);
}
private async Task CancelAsync()
{
await Dialog.CancelAsync();
}
}
- Show the dialog via
IDialogService:
[Inject] private IDialogService DialogService { get; set; } = default!;
private async Task ShowEditDialog()
{
var dialog = await DialogService.ShowDialogAsync<EditPersonDialog, Person>(
person,
new DialogParameters
{
Title = "Edit Person",
PrimaryAction = "Save",
SecondaryAction = "Cancel",
Width = "500px",
PreventDismissOnOverlayClick = true,
});
var result = await dialog.Result;
if (!result.Cancelled)
{
var updatedPerson = result.Data as Person;
}
}
For convenience dialogs:
await DialogService.ShowConfirmationAsync("Are you sure?", "Yes", "No");
await DialogService.ShowSuccessAsync("Done!");
await DialogService.ShowErrorAsync("Something went wrong.");
8. Toast notifications
[Inject] private IToastService ToastService { get; set; } = default!;
ToastService.ShowSuccess("Item saved successfully");
ToastService.ShowError("Failed to save");
ToastService.ShowWarning("Check your input");
ToastService.ShowInfo("New update available");
FluentToastProvider parameters: Position (default TopRight), Timeout (default 7000ms), MaxToastCount (default 4).
9. Design tokens and themes work only after render
Design tokens rely on JS interop. Never set them in OnInitialized — use OnAfterRenderAsync.
<FluentDesignTheme Mode="DesignThemeModes.System"
OfficeColor="OfficeColor.Teams"
StorageName="mytheme" />
10. FluentEditForm vs EditForm
FluentEditForm is only needed inside FluentWizard steps (per-step validation). For regular forms, use standard EditForm with Fluent form components:
<EditForm Model="@model" OnValidSubmit="HandleSubmit">
<DataAnnotationsValidator />
<FluentTextField @bind-Value="@model.Name" Label="Name" Required />
<FluentSelect Items="@options"
OptionText="@(o => o.Label)"
@bind-SelectedOption="@model.Category"
Label="Category" />
<FluentValidationSummary />
<FluentButton Type="ButtonType.Submit" Appearance="Appearance.Accent">Save</FluentButton>
</EditForm>
Use FluentValidationMessage and FluentValidationSummary instead of standard Blazor validation components for Fluent styling.
Reference files
For detailed guidance on specific topics, see:
Frequently asked questions about Fluent UI Blazor
Similar skills
Playwright Component Testing
Test React and Vue components in isolation with Playwright.
Build MCP App
Create interactive UI widgets for MCP servers.
Web Design Reviewer
Identify and fix design issues in websites efficiently.
Markstream Install
Seamlessly integrate Markstream for Markdown rendering.
GSAP & Framer Scroll Animation
Create advanced scroll animations effortlessly.
Zoom Video SDK UI Toolkit
Prebuilt UI for Zoom video conferencing in web apps.
