Skip to content

FloatWidget

Namespace: Hex1b.Widgets

Assembly: Hex1b.dll

Wraps a child widget and removes it from the container's normal layout flow. The float is positioned either at absolute coordinates or relative to an anchor widget.

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

Inheritance

ObjectHex1bWidgetFloatWidget

Implements

Constructors

FloatWidget(Hex1bWidget)

Wraps a child widget and removes it from the container's normal layout flow. The float is positioned either at absolute coordinates or relative to an anchor widget.

Parameters:

  • Child (Hex1bWidget): The child widget to float out of the layout flow.
csharp
public FloatWidget(Hex1bWidget Child)

Properties

Child

The child widget to float out of the layout flow.

Returns: Hex1bWidget

csharp
public Hex1bWidget Child { get; init; }

Methods

Absolute(int, int)

Positions the float at absolute (x, y) character coordinates within the container.

Parameters:

Returns: FloatWidget

csharp
public FloatWidget Absolute(int x, int y)

AlignBottom(Hex1bWidget, int)

Float's bottom edge aligns with anchor's bottom edge.

Parameters:

Returns: FloatWidget

csharp
public FloatWidget AlignBottom(Hex1bWidget anchor, int offset = 0)

AlignLeft(Hex1bWidget, int)

Float's left edge aligns with anchor's left edge.

Parameters:

Returns: FloatWidget

csharp
public FloatWidget AlignLeft(Hex1bWidget anchor, int offset = 0)

AlignRight(Hex1bWidget, int)

Float's right edge aligns with anchor's right edge.

Parameters:

Returns: FloatWidget

csharp
public FloatWidget AlignRight(Hex1bWidget anchor, int offset = 0)

AlignTop(Hex1bWidget, int)

Float's top edge aligns with anchor's top edge.

Parameters:

Returns: FloatWidget

csharp
public FloatWidget AlignTop(Hex1bWidget anchor, int offset = 0)

ExtendBottom(Hex1bWidget, int)

Float's top edge aligns with anchor's bottom edge (place below).

Parameters:

Returns: FloatWidget

csharp
public FloatWidget ExtendBottom(Hex1bWidget anchor, int offset = 0)

ExtendLeft(Hex1bWidget, int)

Float's right edge aligns with anchor's left edge (place beside, to the left).

Parameters:

Returns: FloatWidget

csharp
public FloatWidget ExtendLeft(Hex1bWidget anchor, int offset = 0)

ExtendRight(Hex1bWidget, int)

Float's left edge aligns with anchor's right edge (place beside, to the right).

Parameters:

Returns: FloatWidget

csharp
public FloatWidget ExtendRight(Hex1bWidget anchor, int offset = 0)

ExtendTop(Hex1bWidget, int)

Float's bottom edge aligns with anchor's top edge (place above).

Parameters:

Returns: FloatWidget

csharp
public FloatWidget ExtendTop(Hex1bWidget anchor, int offset = 0)

Remarks

FloatWidget is not reconciled directly — the parent container (VStack, HStack, etc.) detects float children and handles their reconciliation, measurement, and arrangement separately from flow children. Floats render after all flow children to maintain correct z-ordering.

Examples

csharp
// Absolute positioning
ctx.VStack(v => [
    v.Text("Normal flow"),
    v.Float(v.Icon("📍")).Absolute(10, 5),
])

// Anchor-relative positioning
var header = v.Text("Header");
ctx.VStack(v => [
    header,
    v.Float(v.Text("Tooltip")).AlignRight(header).ExtendBottom(header),
])

Released under the MIT License.