| title | StatusBar Specs |
|---|
This document captures design and implementation notes for StatusBar.
Note
For end-user usage and examples, see StatusBar.
- Status: Implemented
- Primary purpose: Provide a single-row bar with left- and right-aligned content.
- Key goals:
- simple layout for "status left, hints right" use cases
- cheap to render (single row background fill)
- composition-friendly: left and right slots accept any
Visual
- Non-goals:
- multi-row status area (compose with
VStack,Footer, orDockLayout) - command routing and key handling (StatusBar is presentational)
- multi-row status area (compose with
StatusBar is a more "classic" primitive; new apps often prefer Header/Footer for richer layout.
- Primary implementation:
src/XenoAtom.Terminal.UI/Controls/StatusBar.cssrc/XenoAtom.Terminal.UI/Styling/StatusBarStyle.cs
- Tests:
src/XenoAtom.Terminal.UI.Tests/StatusBarRenderingTests.cs
- Demo:
samples/ControlsDemo/Demos/StatusBarDemo.cs
StatusBar : Visual(sealed)
HorizontalAlignment = Align.StretchVerticalAlignmentuses theVisualdefault (typicallyAlign.Start)
LeftText : Visual?(bindable)RightText : Visual?(bindable)
The children are the two slot visuals when present.
There are no events and no input handling.
StatusBar is a single-row control (height 1).
Measurement rules:
- Both
LeftTextandRightTextare measured with:- width:
[0 .. Infinite] - height:
[0 .. 1]
- width:
- The required width is the sum of both desired widths.
- The returned hints are:
min = (0, 1)natural = clamp(requiredWidth, 1)- horizontal flex: grow 1 / shrink 1 (
SizeHints.FlexX(...))
StatusBar arranges each slot into a 1-row rectangle:
- Left:
x = finalRect.Xwidth = min(finalRect.Width, left.DesiredSize.Width)
- Right:
width = min(finalRect.Width, right.DesiredSize.Width)x = finalRect.X + (finalRect.Width - width)
Important: there is no collision resolution. If the total content width exceeds the available width, the arranged rectangles can overlap. The final visual result depends on rendering order (children render after the parent fill).
The StatusBar renders a single row background fill across Bounds.Width using StatusBarStyle.Resolve(theme).
Children then render on top. Since the background fill writes a full row of styled spaces, children that render with
Style.None inherit the status bar baseline styling.
StatusBarStyle exposes:
Background : Color?Foreground : Color?
Resolve behavior:
- foreground defaults to
theme.Foregroundwhen not specified - background is optional (when null, background is not set on the style)
TextStyle.Boldis always applied
StatusBarRenderingTests.StatusBar_Renders_Left_And_Rightvalidates that both slots appear when hosted in a layout.- ControlsDemo shows usage with
Markupslots withWrap = false, embedded in a bordered panel.
- Optional slot spacing or padding (currently handled by providing padded slot visuals).
- Optional "collapse rules" (e.g., hide right slot first under tight widths) if overlap becomes problematic.