Skip to content

BackdropWidget

Namespace: Hex1b.Widgets

Assembly: Hex1b.dll

A widget that fills its available space and intercepts all input. Used as a modal backdrop to prevent interaction with layers below. Can optionally display a background color (for dimming effects) and trigger a callback when clicked (for "click-away to dismiss" behavior).

csharp
public sealed record BackdropWidget : Hex1bWidget, IEquatable<Hex1bWidget>, IEquatable<BackdropWidget>

Inheritance

ObjectHex1bWidgetBackdropWidget

Implements

Constructors

BackdropWidget(Hex1bWidget?)

A widget that fills its available space and intercepts all input. Used as a modal backdrop to prevent interaction with layers below. Can optionally display a background color (for dimming effects) and trigger a callback when clicked (for "click-away to dismiss" behavior).

Parameters:

  • Child (Hex1bWidget): Optional child widget to display on top of the backdrop.
csharp
public BackdropWidget(Hex1bWidget? Child = null)

Properties

Child

Optional child widget to display on top of the backdrop.

Returns: Hex1bWidget

csharp
public Hex1bWidget? Child { get; init; }

Methods

OnClickAway(Action)

Sets a simple callback to be invoked when clicking on the backdrop (outside child content).

Parameters:

  • handler (Action): The click-away handler.

Returns: BackdropWidget

A new BackdropWidget with the handler set.

csharp
public BackdropWidget OnClickAway(Action handler)

OnClickAway(Action<BackdropClickedEventArgs>)

Sets a rich callback with event args to be invoked when clicking on the backdrop. The event args include click coordinates and the layer ID for popup stack integration.

Parameters:

Returns: BackdropWidget

A new BackdropWidget with the handler set.

csharp
public BackdropWidget OnClickAway(Action<BackdropClickedEventArgs> handler)

OnClickAway(Func<BackdropClickedEventArgs, Task>)

Sets a rich async callback with event args to be invoked when clicking on the backdrop. The event args include click coordinates and the layer ID for popup stack integration.

Parameters:

Returns: BackdropWidget

A new BackdropWidget with the handler set.

csharp
public BackdropWidget OnClickAway(Func<BackdropClickedEventArgs, Task> handler)

OnClickAway(Func<Task>)

Sets a simple async callback to be invoked when clicking on the backdrop (outside child content).

Parameters:

  • handler (Func<Task>): The async click-away handler.

Returns: BackdropWidget

A new BackdropWidget with the handler set.

csharp
public BackdropWidget OnClickAway(Func<Task> handler)

Opaque(Hex1bColor)

Sets the backdrop to opaque mode with the specified background color.

Parameters:

Returns: BackdropWidget

A new BackdropWidget with opaque style.

csharp
public BackdropWidget Opaque(Hex1bColor color)

Transparent()

Sets the backdrop to transparent mode - base layer shows through unchanged.

Returns: BackdropWidget

A new BackdropWidget with transparent style.

csharp
public BackdropWidget Transparent()

WithBackground(Hex1bColor)

Sets the background color for the backdrop (implies opaque mode).

Parameters:

Returns: BackdropWidget

A new BackdropWidget with the background color set.

csharp
public BackdropWidget WithBackground(Hex1bColor color)

WithLayerId(string)

Sets a layer identifier for this backdrop. Used by PopupStack to identify which layer was clicked.

Parameters:

  • id (String): The layer identifier.

Returns: BackdropWidget

A new BackdropWidget with the layer ID set.

csharp
public BackdropWidget WithLayerId(string id)

Fields

ClickAwayAction

Returns: ActionId

csharp
public static readonly ActionId ClickAwayAction

DismissAction

Returns: ActionId

csharp
public static readonly ActionId DismissAction

Released under the MIT License.