Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
4411140
Copy component from v4
MarvinKlein1508 Nov 27, 2025
f047443
Add default demo
MarvinKlein1508 Nov 27, 2025
2ec50b4
Use CultureInfo.InvariantCulture
MarvinKlein1508 Nov 27, 2025
cfccd25
Use default builders
MarvinKlein1508 Nov 27, 2025
40c84fb
Update sample
MarvinKlein1508 Nov 27, 2025
84d2955
Display value
MarvinKlein1508 Nov 27, 2025
9077085
Update sample
MarvinKlein1508 Nov 27, 2025
80237e6
Update sample
MarvinKlein1508 Nov 27, 2025
e9e6820
Remove default values for default types
MarvinKlein1508 Nov 27, 2025
5102804
Added timed demo
MarvinKlein1508 Nov 27, 2025
4c7adfb
Update default demo
MarvinKlein1508 Nov 27, 2025
1948396
Added transparent demo
MarvinKlein1508 Nov 27, 2025
ccfbfba
Added background color demo
MarvinKlein1508 Nov 27, 2025
cc44c17
Add fullscreen demo
MarvinKlein1508 Nov 27, 2025
eaafd00
Add Interactive demo
MarvinKlein1508 Nov 27, 2025
ec83319
Work on FluentOverlay interactive
MarvinKlein1508 Nov 27, 2025
d0362f3
Fix path
MarvinKlein1508 Nov 27, 2025
4eed8bf
Work on overlay
MarvinKlein1508 Nov 27, 2025
493d9a5
Comment in
MarvinKlein1508 Nov 27, 2025
32f71e0
Work on interactive mode
MarvinKlein1508 Nov 27, 2025
d1c5129
Fix interactive mode
MarvinKlein1508 Nov 27, 2025
bb18895
Use existing method for disposing
MarvinKlein1508 Nov 27, 2025
03c061e
Code cleanup
MarvinKlein1508 Nov 27, 2025
419a329
Remove obsolete component
MarvinKlein1508 Nov 27, 2025
412ef59
Update samples
MarvinKlein1508 Nov 27, 2025
6b5b503
Add gap
MarvinKlein1508 Nov 27, 2025
26d97ca
Merge branch 'dev-v5' into migrate-overlay
vnbaaij Nov 27, 2025
5a3e1c7
Code review fixes
MarvinKlein1508 Nov 27, 2025
d3cae9d
Merge branch 'migrate-overlay' of https://github.com/MarvinKlein1508/…
MarvinKlein1508 Nov 27, 2025
13448bc
Specify DotNet.DotNetObject type
MarvinKlein1508 Nov 27, 2025
1ebcc8d
Move into OnInitialized
MarvinKlein1508 Nov 27, 2025
db61322
use HTMLElement
MarvinKlein1508 Nov 27, 2025
bf61d5f
Set ZIndex above tooltip
MarvinKlein1508 Nov 28, 2025
06e942b
Add support for AdditionalAttributes
MarvinKlein1508 Nov 28, 2025
b502881
Added first test case
MarvinKlein1508 Nov 28, 2025
a94657a
Add support for all kind of background-color values
MarvinKlein1508 Nov 28, 2025
57f539c
Update comments and remove OnInitialized
MarvinKlein1508 Nov 28, 2025
4fec9a5
Merge branch 'dev-v5' into migrate-overlay
vnbaaij Nov 28, 2025
a875ca3
Merge branch 'migrate-overlay' of https://github.com/MarvinKlein1508/…
MarvinKlein1508 Nov 28, 2025
03b23fc
Make opacity double again to allow percentage values.
MarvinKlein1508 Nov 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

<FluentButton Appearance="ButtonAppearance.Primary" @onclick="() => visible = !visible">Show Overlay</FluentButton>

<FluentOverlay @bind-Visible="visible"
Opacity="60"
BackgroundColor="rgba(255, 0, 0, 1)"
OnClose="HandleOnClose">
<FluentSpinner />
</FluentOverlay>

@code {
private bool visible;

private void HandleOnClose()
{
Console.WriteLine("Custom background color overlay closed");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
@using Microsoft.FluentUI.AspNetCore.Components.Extensions

<FluentSelect Items="@(Enum.GetValues<JustifyContent>())"
OptionValue="@(c => c.ToAttributeValue())"
@bind-Value="@justification" />

<FluentSelect Items="@(Enum.GetValues<HorizontalAlignment>())"
OptionValue="@(c => c.ToAttributeValue())"
@bind-Value="@alignment" />

<br />
<br />

<FluentButton Appearance="ButtonAppearance.Primary" @onclick="() => visible = !visible">Show Overlay</FluentButton>

<FluentOverlay @bind-Visible="visible"
Transparent="false"
Alignment="alignment"
Justification="justification"
OnClose="HandleOnClose">
<FluentSpinner />
</FluentOverlay>

@code {
private bool visible;
private JustifyContent justification = JustifyContent.Center;
private HorizontalAlignment alignment = HorizontalAlignment.Center;

private void HandleOnClose()
{
Console.WriteLine("Overlay closed");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

<FluentButton Appearance="ButtonAppearance.Primary" @onclick="() => visible = !visible">Show Overlay</FluentButton>

<FluentOverlay @bind-Visible="visible"
BackgroundColor="#e8f48c"
FullScreen="true"
OnClose="HandleOnClose"
PreventScroll="true">
<FluentSpinner />
</FluentOverlay>

@code {
private bool visible;

private void HandleOnClose()
{
Console.WriteLine("Full screen overlay closed");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@

<FluentStack HorizontalGap="10px">
<FluentSwitch @bind-Value="interactive" Label="Interactive" />
<FluentSwitch @bind-Value="interactiveExceptId" Label="Exception Zone (my-zone)" Disabled="@(!interactive)" />
<FluentSwitch @bind-Value="fullScreen" Label="Full screen" />
</FluentStack>

<FluentButton Appearance="ButtonAppearance.Primary"
Style="margin: 24px 0px;"
@onclick="() => visible = !visible">
Show Overlay
</FluentButton>

<FluentStack VerticalAlignment="VerticalAlignment.Center">
<FluentButton OnClick="@(e => counter++)">Increment</FluentButton>
<FluentLabel>Counter: @counter</FluentLabel>
</FluentStack>

<FluentOverlay @bind-Visible="visible"
BackgroundColor="#e8f48c"
FullScreen="fullScreen"
Interactive="interactive"
InteractiveExceptId="@(interactiveExceptId ? "my-zone" : null)"
OnClose="HandleOnClose"
PreventScroll="true">
@if (interactive)
{
<div id="my-zone">
<p>Non-interactive zone</p>
<FluentSpinner />
</div>
}
else
{
<FluentSpinner />
}
</FluentOverlay>

<style>
#my-zone {
background-color: var(--colorNeutralBackground1);
width: 200px;
height: 160px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}

#my-zone p {
color: var(--colorNeutralForeground1);
}
</style>

@code {
private bool visible;
private bool interactive = true;
private bool interactiveExceptId = true;
private bool fullScreen = true;
private int counter = 0;

private void HandleOnClose()
{
Console.WriteLine("Overlay closed");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
@using Microsoft.FluentUI.AspNetCore.Components.Extensions

<FluentSelect Items="@(Enum.GetValues<JustifyContent>())"
OptionValue="@(c => c.ToAttributeValue())"
@bind-Value="justification" />

<FluentSelect Items="@(Enum.GetValues<HorizontalAlignment>())"
OptionValue="@(c => c.ToAttributeValue())"
@bind-Value="alignment" />
<br />
<br />

<FluentButton Appearance="ButtonAppearance.Primary" @onclick="HandleOnOpen">Show Overlay</FluentButton>

<FluentOverlay @bind-Visible="visible"
Alignment="alignment"
Justification="justification">
<FluentSpinner />
</FluentOverlay>

@code {
private bool visible;
private JustifyContent justification = JustifyContent.Center;
private HorizontalAlignment alignment = HorizontalAlignment.Center;

private async Task HandleOnOpen()
{
visible = true;
Console.WriteLine("Overlay opened");
await Task.Delay(3000);
visible = false;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

<FluentButton Appearance="ButtonAppearance.Primary" @onclick="() => visible = !visible">Show Overlay</FluentButton>

<FluentOverlay @bind-Visible="visible" OnClose="HandleOnClose" Transparent="true">
<FluentSpinner />
</FluentOverlay>

@code {
private bool visible;

private void HandleOnClose()
{
Console.WriteLine("Transparent overlay closed");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
title: Overlay
route: /Overlay
---

# Overlay

Overlays are used to temporarily overlay screen content to focus a dialog, progress or other information/interaction.

## Default

{{ OverlayDefault }}

## Timed

A timed overlay that hides after being shown for 3 seconds

{{ OverlayTimed }}

## Transparent overlay

Overlay with a transparent background

{{ OverlayTransparent }}

## Background color

Overlay with a custom background color

{{ OverlayBackgroundColor }}

## Full screen

Overlay which takes up the whole screen.

{{ OverlayFullScreen }}

## Interactive
By using the `Interactive` and `InteractiveExceptId` properties, only the targeted element will not close the FluentOverlay panel. The user can click anywhere else to close the FluentOverlay.
In this example, the FluentOverlay will only close when the user clicks outside the white zone and the user can increment the counter before to close the Overlay.

{{ OverlayInteractive }}

## API FluentOverlay

{{ API Type=FluentOverlay }}
17 changes: 17 additions & 0 deletions src/Core/Components/Overlay/FluentOverlay.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@namespace Microsoft.FluentUI.AspNetCore.Components
@inherits FluentComponentBase

@if (Visible)
{
<div class="@ClassValue"
style="@StyleValue"
id="@Id"
@attributes="@AdditionalAttributes"
@onclick="@OnCloseHandlerAsync"
@oncontextmenu="@OnCloseHandlerAsync"
@oncontextmenu:preventDefault="true">
<div style="@StyleContentValue">
@ChildContent
</div>
</div>
}
Loading
Loading