# Setup and Configuration ## NuGet Packages | Package | Purpose | |---|---| | `Microsoft.FluentUI.AspNetCore.Components` | Core component library (required) | | `Microsoft.FluentUI.AspNetCore.Components.Icons` | Icon package (optional, recommended) | | `Microsoft.FluentUI.AspNetCore.Components.Emojis` | Emoji package (optional) | | `Microsoft.FluentUI.AspNetCore.Components.DataGrid.EntityFrameworkAdapter` | EF Core adapter for DataGrid (optional) | | `Microsoft.FluentUI.AspNetCore.Components.DataGrid.ODataAdapter` | OData adapter for DataGrid (optional) | ## Program.cs Registration ```csharp builder.Services.AddFluentUIComponents(); ``` ### Configuration Options (LibraryConfiguration) | Property | Type | Default | Notes | |---|---|---|---| | `UseTooltipServiceProvider` | `bool` | `true` | Registers `ITooltipService`. If true, you MUST add `` to layout | | `RequiredLabel` | `MarkupString` | Red `*` | Custom markup for required field indicators | | `HideTooltipOnCursorLeave` | `bool` | `false` | Close tooltip when cursor leaves both anchor and tooltip | | `ServiceLifetime` | `ServiceLifetime` | `Scoped` | Only `Scoped` or `Singleton`. `Transient` throws! | | `ValidateClassNames` | `bool` | `true` | Validates CSS class names against `^-?[_a-zA-Z]+[_a-zA-Z0-9-]*$` | | `CollocatedJavaScriptQueryString` | `Func?` | `v={version}` | Cache-busting for JS files | ### ServiceLifetime by hosting model | Hosting model | ServiceLifetime | |---|---| | Blazor Server | `Scoped` (default) | | Blazor WebAssembly Standalone | `Singleton` | | Blazor Web App (Interactive) | `Scoped` (default) | | Blazor Hybrid (MAUI) | `Singleton` | ## MainLayout.razor Template ```razor @inherits LayoutComponentBase My App Home Counter General Profile @Body @* Required providers — place after FluentLayout *@ @* Theme — place at root *@ ``` Or use the convenience component: ```razor @code { private RenderFragment header = @My App; private RenderFragment navMenu = @
Home
; private RenderFragment body = @
@Body
; } ``` ## _Imports.razor Add this to your `_Imports.razor`: ```razor @using Microsoft.FluentUI.AspNetCore.Components @using Icons = Microsoft.FluentUI.AspNetCore.Components.Icons ``` ## Static Web Assets No manual `` or `