All skills
github avatar

/fluentui-blazor

@c824a3c official
by githubgithub/awesome-copilot40k stars
5,040

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, FluentDesignTheme, or any component prefixed with "Fluent". Also use when troubleshooting missing providers, JS interop issues, or theming.

Use this Skill: https://skilld.dev/gh/github/awesome-copilot/fluentui-blazor

This session only. Nothing lands on disk.

referencesTHEMING.md

≈859 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Theming

FluentDesignTheme (recommended)

The primary theming component. Place it at the root of your app.

<FluentDesignTheme Mode="DesignThemeModes.System"
                   OfficeColor="OfficeColor.Teams"
                   StorageName="mytheme" />

Parameters

Parameter Type Default Description
Mode DesignThemeModes System Light, Dark, or System (follows OS)
CustomColor string? null Hex accent color (e.g. "#0078D4")
OfficeColor OfficeColor? null Preset accent: Teams, Word, Excel, PowerPoint, Outlook, OneNote
NeutralBaseColor string? null Neutral palette base hex color
StorageName string? null Persist theme to localStorage under this key
Direction LocalizationDirection? null Ltr or Rtl
OnLuminanceChanged EventCallback<LuminanceChangedEventArgs> Fired when dark/light mode changes
OnLoaded EventCallback<LoadedEventArgs> Fired when theme is loaded from storage

Two-way binding

<FluentDesignTheme @bind-Mode="@themeMode"
                   @bind-OfficeColor="@officeColor"
                   @bind-CustomColor="@customColor"
                   StorageName="mytheme" />

<FluentSelect Items="@(Enum.GetValues<DesignThemeModes>())"
              @bind-SelectedOption="@themeMode"
              OptionText="@(m => m.ToString())" />

@code {
    private DesignThemeModes themeMode = DesignThemeModes.System;
    private OfficeColor? officeColor = OfficeColor.Teams;
    private string? customColor;
}

Important: JS interop dependency

FluentDesignTheme uses JavaScript interop internally. It will NOT work during server-side pre-rendering. If you need to react to theme changes:

// Use OnAfterRenderAsync, NOT OnInitialized
protected override async Task OnAfterRenderAsync(bool firstRender)
{
    if (firstRender)
    {
        // Safe to interact with design tokens here
    }
}

FluentDesignSystemProvider (advanced)

For scoping design tokens to a subtree of the component tree. Provides 50+ CSS custom properties.

<FluentDesignSystemProvider AccentBaseColor="#0078D4"
                            NeutralBaseColor="#808080"
                            BaseLayerLuminance="0.95">
    <FluentButton Appearance="Appearance.Accent">Themed Button</FluentButton>
</FluentDesignSystemProvider>

Design Token Classes (DI-based, advanced)

For programmatic token control via dependency injection. Each token is a generated service.

@inject AccentBaseColor AccentBaseColor

protected override async Task OnAfterRenderAsync(bool firstRender)
{
    if (firstRender)
    {
        // Set token for a specific element
        await AccentBaseColor.SetValueFor(myElement, "#FF0000".ToSwatch());

        // Read token value
        var currentColor = await AccentBaseColor.GetValueFor(myElement);

        // Remove override
        await AccentBaseColor.DeleteValueFor(myElement);
    }
}

Available DesignThemeModes

  • DesignThemeModes.Light — light theme
  • DesignThemeModes.Dark — dark theme
  • DesignThemeModes.System — follows OS preference

Available OfficeColor presets

Teams, Word, Excel, PowerPoint, Outlook, OneNote, Loop, Planner, SharePoint, Stream, Sway, Viva, VivaEngage, VivaInsights, VivaLearning, VivaTopics.

Source: SKILL.md on GitHub

1 warning16d5 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    The skill is a legitimate guide for Microsoft's Fluent UI Blazor component library. It provides detailed documentation on setup, configuration, and usage of various UI components without any malicious patterns.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW · No issues

  • Runlayer7mo

    5/5 files flagged

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at c824a3c. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 20 hours ago.

Activeupdated 8 months ago
  • TypeScript
  • blazor
  • fluentui
  • aspnet
  • components
  • forms
  • dialogs
  • theming

README badge

README badge for github/awesome-copilot/fluentui-blazor

Teaches how to use the Microsoft.FluentUI.AspNetCore.Components NuGet package in Blazor applications, covering component setup, service providers, icon usage, list binding patterns, dialogs, toasts, and theming. Addresses common pitfalls like manual script tags, missing providers, and incorrect form patterns specific to Fluent UI Blazor components.

Generated from the current SKILL.md.

Do I need to manually add script or link tags for Fluent UI?
No. The library auto-loads all CSS and JS via Blazor's static web assets and JS initializers. Manual script or link tags are not needed.
What providers must I add to my layout?
FluentToastProvider, FluentDialogProvider, FluentMessageBarProvider, FluentTooltipProvider, and FluentKeyCodeProvider must be added to your root layout (e.g. MainLayout.razor) for their corresponding services to work without silent failures.
How do I use icons with Fluent UI Blazor?
Install the separate Microsoft.FluentUI.AspNetCore.Components.Icons NuGet package, then use strongly-typed icon classes via the pattern Icons.[Variant].[Size].[Name], e.g. Icons.Regular.Size24.Save. String-based icon names are not supported.
What ServiceLifetime should I use when registering AddFluentUIComponents?
Use ServiceLifetime.Scoped for Blazor Server or Interactive (default), or ServiceLifetime.Singleton for Blazor WebAssembly standalone. Transient is not supported and throws NotSupportedException.
How do FluentSelect and FluentAutocomplete differ from InputSelect?
They use Items, OptionText, and OptionValue properties instead of option child elements. FluentAutocomplete also requires an OnOptionsSearch callback to filter options and uses ValueText instead of the obsolete Value property.

Generated from the current SKILL.md. These answers refresh after source changes.