Skip to content
Skillpedia
Websites & UI (frontend)40k · #5148

fluentui-blazor

Helps your agent use visual components for Blazor applications. It provides guidance on how to use the Fluent UI Blazor library. Useful for creating modern user interfaces.

What it does

This guide teaches how to use the Fluent UI Blazor component library in your applications. It shows how to set it up, add components like buttons and menus, and use features like dialogs and notifications.

When to use it

  • ✓When building a Blazor app with modern visual components.
  • ✓When you need to add buttons, menus, text fields, or interactive tables.
  • ✓When you want to display messages, dialogs, or notifications to the user.

Example of what to ask your AI

“How do I add a clickable button to my Blazor page using Fluent UI?”

Want more? Open the sections below.

How to use

The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.

Skill link

https://github.com/github/awesome-copilot/blob/main/skills/fluentui-blazor/SKILL.md

Ready-to-paste message

Use this skill to help me: https://github.com/github/awesome-copilot/blob/main/skills/fluentui-blazor/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
How it works

The library configures itself automatically. You just need to add a few 'providers' in your main layout and register the library in your project's startup code. Then, you can use the components directly in your code.

Installation

Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.

In the terminal (Claude Code, Codex, Cursor), in your project folder:

npx skills add github/awesome-copilot --skill fluentui-blazor

Or download just the file:

curl -L https://raw.githubusercontent.com/github/awesome-copilot/main/skills/fluentui-blazor/SKILL.md -o SKILL.md
Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Fluent 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 standalone
  • ServiceLifetime.Transient — throws NotSupportedException

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 text
  • OptionValue — Func<TOption, string?> to extract the value string
  • SelectedOption / SelectedOptionChanged — for single selection binding
  • SelectedOptions / 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 (NOT Value — it's obsolete) for the search input text
  • OnOptionsSearch is 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:

  1. 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();
    }
}
  1. Show the dialog via IDialogService:
[Inject] private IDialogService DialogService { get; set; } = default!;

private async Task ShowEditDialog()
{
    var dialog = await DialogService.ShowDialogAsync<EditPersonDialog, Person>(
        person,

…
FAQ

Do I need to add CSS or JavaScript files manually?

No, the library loads everything automatically. Never add manual `<script>` or `<link>` tags for the core library.

Why aren't my dialogs or notifications working?

You need to add the 'Provider' components (like `<FluentDialogProvider />`) to your main layout (`MainLayout.razor`) for them to work correctly.

How do I use icons?

You need to install an additional NuGet package (`Microsoft.FluentUI.AspNetCore.Components.Icons`) and use the icon classes directly in your code, like `Icons.Regular.Size24.Save`.

Details

Original description by the author

Guide for using the Microsoft Fluent UI Blazor component library (Microsoft.FluentUI.AspNetCore.Components NuGet package) in Blazor applications. Use this when the user is building a Blazor app with Fluent UI components, setting up the library, using FluentUI components like FluentButton, FluentDataGrid, FluentDialog, FluentToast, FluentNavMenu, FluentTextField, FluentSelect, FluentAutocomplete, F

repo: github/awesome-copilot

Popularity

GitHub stars
40k
Ranking position
#5148
License
MIT
Updated
10/15/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills