Positioning & Layers
By default, RTXUI components arrange elements within the standard flexbox layout flow. For overlay blocks, modals, status bars, or layered widgets, you can use absolute coordinates and z-index ordering.
1. Positioning Modes (position)
RTXUI supports element positioning contexts:
static(Default): The element renders in order within the normal flex layout flow.relative: The element remains in the normal flow but establishes a reference origin point for any descendant child elements set toposition: absolute.absolute: The element is removed from the normal flow. It is positioned relative to its closest ancestor whosepositionis notstatic(or the screen if there is none). As in CSS, its offsets are measured from inside that ancestor's border:top: 0; left: 0is the first cell of its padding box.fixed: The element is removed from the normal flow and positioned relative to the outermost terminal screen viewport.sticky: The element is positioned based on the user's scroll position. It behaves likerelativeuntil the viewport scrolls past a given offset (such astop: 0), at which point it "sticks" to that position, similar tofixed.
2. Offset Coordinates
For elements configured with position: absolute, position: fixed, or position: sticky, use these properties to set the spacing offsets from the container margins (measured in character cells):
left: Spacing from the container's left edge.right: Spacing from the container's right edge.top: Spacing from the container's top edge.bottom: Spacing from the container's bottom edge.
A sticky element honours all four offsets. top/left pin it as it scrolls up or left out of view; bottom/right pin it while it is still below or to the right of the viewport, which is how a footer stays visible until the content it belongs to scrolls past. When both edges of one axis are set, the leading edge (top, left) wins.
<div class="modal-box">Centered Overlay</div>
<style>
.modal-box {
position: absolute;
top: 5;
left: 10;
width: 40;
height: 10;
border: solid;
}
</style>3. Layer Ordering (z-index)
To manage depth when multiple absolute or fixed elements overlap, assign the drawing layers using z-index:
- Elements with a higher
z-indexare drawn on top of elements with lower values. - Default
z-indexvalue is0(where overlap order falls back to template declaration order).
<div class="background-pane">Behind (z-index = 1)</div>
<div class="foreground-pane">In Front (z-index = 10)</div>
<style>
.background-pane {
position: absolute;
z-index: 1;
}
.foreground-pane {
position: absolute;
z-index: 10;
}
</style>Interactive Demo
Below is the interactive tab view for layout layering:
Sticky Positioning Demo
The interactive demo below showcases position: sticky inside a scrollable container. Notice how category headers stay pinned at the top until they are pushed out of the way by the next category.

