/csharp-dotnet-development:fluentui-blazorfrom csharp-dotnet-development
Guides using Microsoft.FluentUI.AspNetCore.Components in Blazor apps: setup, providers, component binding for FluentSelect/Combobox/Autocomplete, dialogs, toasts, icons, themes, DataGrid, and NavMenu.
Ships in csharp-dotnet-development. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Use Microsoft.FluentUI.AspNetCore.Components in Blazor applications by selecting the correct setup, provider, binding, service, icon, and theming pattern, then produce paste-ready Razor or C# that follows the library's v4 conventions.
| Concern | Required pattern | Failure to avoid |
|---|---|---|
| Core package | Install and use Microsoft.FluentUI.AspNetCore.Components; register builder.Services.AddFluentUIComponents(); in Program.cs. | Do not add manual <script> or <link> tags for the core library; static web assets and JS initializers load CSS and JS. |
| Service lifetime | Use ServiceLifetime.Scoped for Blazor Server or interactive apps; use ServiceLifetime.Singleton for standalone Blazor WebAssembly. | ServiceLifetime.Transient throws NotSupportedException. |
| Providers | Put <FluentToastProvider />, <FluentDialogProvider />, <FluentMessageBarProvider />, <FluentTooltipProvider />, and <FluentKeyCodeProvider /> in the root layout such as MainLayout.razor. | Service calls can fail silently with no error and no UI when the provider is missing. |
| Configuration | Use AddFluentUIComponents(options => { options.UseTooltipServiceProvider = true; options.ServiceLifetime = ServiceLifetime.Scoped; }); when defaults must be explicit. | Do not scatter service setup across components. |
FluentSelect<TOption>, FluentCombobox<TOption>, FluentListbox<TOption>, and FluentAutocomplete<TOption> do not use the <InputSelect> child-<option> model.
| API | Use | Notes |
|---|---|---|
Items | IEnumerable<TOption> data source | Provide objects, not manual option markup. |
OptionText | Func<TOption, string?> display text | Example: @(c => c.Name). |
OptionValue | Func<TOption, string?> value text | Example: @(c => c.Code). |
SelectedOption / SelectedOptionChanged | Single selection binding | Use @bind-SelectedOption. |
SelectedOptions / SelectedOptionsChanged | Multi-selection binding | Use @bind-SelectedOptions. |
ValueText | Autocomplete input text | Use instead of obsolete Value. |
OnOptionsSearch | Autocomplete filtering callback | Set args.Items; Multiple="true" is the default. |
<FluentSelect Items="@countries"
OptionText="@(c => c.Name)"
OptionValue="@(c => c.Code)"
@bind-SelectedOption="@selectedCountry"
Label="Country" />
Do not write this InputSelect pattern:
<FluentSelect @bind-Value="@selectedValue">
<option value="1">One</option>
</FluentSelect>
For autocomplete:
<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));
}
}
| Feature | Correct API | Rule |
|---|---|---|
| Dialog content | Implement IDialogContentComponent<TData> with [Parameter] public Person Content { get; set; } = default!; and [CascadingParameter] public FluentDialog Dialog { get; set; } = default!;. | Do not toggle visibility of <FluentDialog> tags for service dialogs. |
| Dialog service | Inject IDialogService; call ShowDialogAsync<EditPersonDialog, Person>(person, new DialogParameters { Title = "Edit Person", PrimaryAction = "Save", SecondaryAction = "Cancel", Width = "500px", PreventDismissOnOverlayClick = true }); await dialog.Result; test result.Cancelled; cast result.Data as Person. | Use Dialog.CloseAsync(Content) and Dialog.CancelAsync() inside content. |
| Convenience dialogs | ShowConfirmationAsync("Are you sure?", "Yes", "No"), ShowSuccessAsync("Done!"), ShowErrorAsync("Something went wrong."). | Keep provider present. |
| Toasts | Inject IToastService; call ShowSuccess, ShowError, ShowWarning, or ShowInfo. | FluentToastProvider supports Position default TopRight, Timeout default 7000ms, and MaxToastCount default 4. |
| Icons | Add Microsoft.FluentUI.AspNetCore.Components.Icons; use @using Icons = Microsoft.FluentUI.AspNetCore.Components.Icons; render Icons.Regular.Size24.Save, Icons.Filled.Size20.Delete, or Icon.FromImageUrl("/path/to/image.png"). | Do not use string icon names; icons are strongly typed. Variants: Regular, Filled; sizes: Size12, Size16, Size20, Size24, Size28, Size32, Size48. |
| Theme tokens | Render <FluentDesignTheme Mode="DesignThemeModes.System" OfficeColor="OfficeColor.Teams" StorageName="mytheme" />; change design tokens in OnAfterRenderAsync. | Do not set JS-backed design tokens in OnInitialized. |
| Forms | Use standard EditForm, DataAnnotationsValidator, FluentTextField, FluentSelect, FluentValidationMessage, FluentValidationSummary, and FluentButton Type="ButtonType.Submit" Appearance="Appearance.Accent". | Use FluentEditForm only inside FluentWizard steps for per-step validation. |
Read bundled references only when the task needs the extra detail:
references/SETUP.md: setup, service registration, providers, render modes, and static assets.references/LAYOUT-AND-NAVIGATION.md: layout, navigation, FluentNavMenu, and shell patterns.references/DATAGRID.md: FluentDataGrid data, columns, paging, and virtualization.references/THEMING.md: design tokens, FluentDesignTheme, and theme persistence.IDialogService, IToastService, tooltip, message bar, and key code services can appear to do nothing when their provider is missing.Multiple="false" only when a single result is required.OnAfterRenderAsync before setting them programmatically.Icons.[Variant].[Size].[Name] is the supported pattern.The package is a NuGet package and auto-loads static assets; no manual tags are needed.
Provider-backed features are service-based and their providers MUST be in the layout.
Do not use the WRONG string-based or InputSelect pattern; use strongly-typed icons and object binding.
Multi-selection uses SelectedOptions; single selection uses SelectedOption.
@using Icons = Microsoft.FluentUI.AspNetCore.Components.Icons enables icons such as Icons.Filled.Size20.Delete with Color.Error.
Exact image API: Icon.FromImageUrl("/path/to/image.png").
FluentEditForm belongs inside FluentWizard; normal forms use EditForm OnValidSubmit="HandleSubmit".
Dialog examples may include DialogService, DialogService.ShowDialogAsync, ShowEditDialog, SaveAsync, DialogService.ShowConfirmationAsync, DialogService.ShowSuccessAsync, and DialogService.ShowErrorAsync.
Toast examples may include ToastService, ToastService.ShowSuccess, ToastService.ShowError, ToastService.ShowWarning, and ToastService.ShowInfo.
Avoid toggling <FluentDialog> visibility for service dialogs.
Preserve exact tokens @using and multi-selection when explaining icon imports and multi-select binding.
## Fluent UI Blazor result
**Status:** ready | needs provider | blocked
**Target:** <component, file, or feature>
### Implementation
```razor
<paste-ready Razor or C# snippet>
## Quality gate
- [ ] No manual core Fluent UI `<script>` or `<link>` tags were added.
- [ ] `AddFluentUIComponents` and the required providers are present when service-backed components are used.
- [ ] Object list components use `Items`, `OptionText`, `OptionValue`, and selected option bindings instead of child `<option>` markup.
- [ ] Dialogs use `IDialogService` and `IDialogContentComponent<TData>` when service-backed.
- [ ] Icons use the typed `Microsoft.FluentUI.AspNetCore.Components.Icons` package or `Icon.FromImageUrl`.
- [ ] Theme token changes run after render, not in `OnInitialized`.
- [ ] Any referenced bundled file exists and was read only when needed.
What SKILL.md sets; muted values are Claude Code's defaults
9 skills in this plugin
/aspnet-minimal-api-openapiCreate or review ASP.NET Minimal API endpoints with typed results, DTO validation, endpoint groups, filters, ProblemDetails, and OpenAPI documentation. Use this skill when asked to add Minimal APIs, document endpoints with Swagger/OpenAPI, use .NET 9 built-in OpenAPI, or design request and response types./csharp-asyncReview, design, and fix C# async code using Task, Task<T>, ValueTask<T>, cancellation, ConfigureAwait, async streams, and TAP conventions. Use when the user asks for C# async best practices, deadlock fixes, async method naming, parallel awaits, or replacing .Wait(), .Result, and async void./csharp-mstestApply modern MSTest 3.x/4.x testing practices for C# projects. Use when asked to write or review MSTest unit tests, choose assertion APIs, convert ExpectedException tests, design data-driven tests, use TestContext, configure lifecycle hooks, add categories or work items, or run dotnet test for MSTest./csharp-nunitDesign, write, and review NUnit tests for .NET projects, including standard tests, data-driven tests, assertions, setup/teardown, categories, and isolation with mocks. Use this skill when the user asks for NUnit best practices, `dotnet test`, `[TestCase]`, `[TestCaseSource]`, or C# unit test structure./csharp-tunitWrite, review, or migrate C# unit tests using TUnit. Use when the user asks for TUnit best practices, .NET test project setup, TUnit assertions, lifecycle hooks, data-driven tests, parallel execution, retries, categories, or xUnit-to-TUnit migration./csharp-xunitApply xUnit best practices for C# unit tests, including test project setup, Fact and Theory structure, data-driven tests, assertions, fixtures, mocking, categorization, diagnostics, and dotnet test execution. Use when asked for xUnit guidance or to write .NET unit tests.npx claudepluginhub gbb-acelerators/awesome-harness-primitives --plugin csharp-dotnet-developmentOther plugins' skills for the same job