Install any skill in seconds. Free to start, no credit card required.
Get Started Free →This skill teaches how to correctly use the **Microsoft.FluentUI.AspNetCore.Components** (version 4) NuGet package in Blazor applications.
.claude/skills/fluentui-blazor/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-15 | ✗→✓ | ▲ Improved | — | — |
| case-01 | ✗→✓ | ▲ Improved | — | — |
| case-04 | ✗→✓ | ▲ Improved | — | — |
| case-19 | ✗→✓ | ▲ Improved | — | — |
| case-05 | ✗→✓ | ▲ Improved | — | — |
This skill teaches how to correctly use the Microsoft.FluentUI.AspNetCore.Components (version 4) NuGet package in Blazor applications.
<script> or <link> tags neededThe 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.
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).
razor<FluentToastProvider /> <FluentDialogProvider /> <FluentMessageBarProvider /> <FluentTooltipProvider /> <FluentKeyCodeProvider />
csharpbuilder.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 — throws NotSupportedExceptiondotnet add package Microsoft.FluentUI.AspNetCore.Components.IconsUsage with a @using alias:
razor@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]
Regular, FilledSize12, Size16, Size20, Size24, Size28, Size32, Size48Custom image: Icon.FromImageUrl("/path/to/image.png")
Never use string-based icon names — icons are strongly-typed classes.
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 bindingrazor<FluentSelect Items="@countries" OptionText="@(c => c.Name)" OptionValue="@(c => c.Code)" @bind-SelectedOption="@selectedCountry" Label="Country" />
NOT like this (wrong pattern):
razor@* WRONG — do not use InputSelect pattern *@ <FluentSelect @bind-Value="@selectedValue"> <option value="1">One</option> </FluentSelect>
ValueText (NOT Value — it's obsolete) for the search input textOnOptionsSearch is the required callback to filter optionsMultiple="true"razor<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)); } }
Do NOT toggle visibility of <FluentDialog> tags. The service pattern is:
IDialogContentComponent<TData>:csharppublic 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(); } }
IDialogService:csharp[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:
csharpawait DialogService.ShowConfirmationAsync("Are you sure?", "Yes", "No"); await DialogService.ShowSuccessAsync("Done!"); await DialogService.ShowErrorAsync("Something went wrong.");
csharp[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).
Design tokens rely on JS interop. Never set them in OnInitialized — use OnAfterRenderAsync.
razor<FluentDesignTheme Mode="DesignThemeModes.System" OfficeColor="OfficeColor.Teams" StorageName="mytheme" />
FluentEditForm is only needed inside FluentWizard steps (per-step validation). For regular forms, use standard EditForm with Fluent form components:
razor<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.
For detailed guidance on specific topics, see:
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-03 | pass→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-10 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-14 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-15 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-17 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-21 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-01 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-04 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-07 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-22 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-06 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-20 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-13 | pass→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-02 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-19 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-08 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-05 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-09 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-16 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-12 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-18 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-11 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +27 percentage points is the difference between those two pass rates over the 22 comparable cases.
The per-case answers from this run were removed by the retention sweep, so the case table below shows the verdicts without the text either arm produced. The counts above were recorded at the time and are unaffected. Answers are now kept for 180 days.
Other measured skills in the registry, with their headline benchmark lift.