Provides a component for integrating with Microsoft.FeatureManagement in Blazor applications.
Install the NuGet package:
dotnet add package Blazor.FeatureManagement
Enable Feature Management in your Program.cs
.
By default, if the feature flag is disabled, the content inside the FeatureFlag
component will not be rendered. You can optionally provide fallback text or a render fragment to display when the feature is disabled.
@page "/example"
@using Blazor.FeatureManagement
<h1>Feature Management Example</h1>
<FeatureFlag Name="MyFeature">
<h2>My Feature is enabled!</h2>
</FeatureFlag>
@page "/example"
@using Blazor.FeatureManagement
<h1>Feature Management Example</h1>
<FeatureFlag Name="MyFeature" FallbackText="My Feature is disabled">
<h2>My Feature is enabled!</h2>
</FeatureFlag>
@page "/example"
@using Blazor.FeatureManagement
<h1>Feature Management Example</h1>
<FeatureFlag Name="MyFeature">
<ChildContent>
<h2>My Feature is enabled!</h2>
</ChildContent>
<FallbackContent>
<h2>My Feature is disabled</h2>
</FallbackContent>
</FeatureFlag>