| title | Header Specs |
|---|
This document specifies the current behavior and design of the Header control as implemented.
Note
For end-user usage and examples, see Header.
- Provide a lightweight, single-row header bar for app chrome.
- Offer three slots (
Left,Center,Right) with predictable placement and clipping. - Always clear/paint its background so content behind it cannot bleed into the header row.
- Remain allocation-conscious and compatible with the binding dirty model (slot visuals can be dynamic).
- Multi-line header (the header is always height
1). - Automatic wrapping/ellipsis behavior inside slots (delegate to the contained visuals).
- Input handling (the header itself is non-interactive; slots may be interactive).
Left : Visual?Center : Visual?Right : Visual?
- Default alignment:
HorizontalAlignment = Align.Stretch. - Default height:
1(fixed).
- Control:
src/XenoAtom.Terminal.UI/Controls/Header.cs - Style:
src/XenoAtom.Terminal.UI/Styling/HeaderStyle.cs - Demo:
samples/ControlsDemo/Demos/HeaderDemo.cs - Tests (usage as app chrome root):
src/XenoAtom.Terminal.UI.Tests/AppChromeTests.cs
Children are exposed in order: Left, Center, Right (when present).
- Each slot is measured with
maxWidth = infiniteandmaxHeight = 1(single-line). - The natural width is computed as:
leftWidth + rightWidth(whenCenteris null)- otherwise
max(leftWidth + rightWidth, leftWidth + centerWidth + rightWidth)
- Returns
SizeHints.FlexXwith:min = (0, 1)natural = (requiredWidth, 1)growX = 1,shrinkX = 1
This means Header is happy to stretch horizontally but never requests extra height.
Given a final rect (width W):
Leftis arranged atXwith widthmin(W, leftDesiredWidth).Rightis arranged atRight - min(W, rightDesiredWidth).Center(if present) gets at mostmax(0, W - leftW - rightW)cells.- It is arranged centered within that remaining space.
Center will clip naturally if it is wider than the remaining space.
- Header is app chrome: it always clears its entire row to spaces using the resolved header style, ensuring a stable background.
- Slot visuals then render on top through normal visual tree rendering.
HeaderStyle resolves to a single cell Style:
Foreground:HeaderStyle.Foreground ?? theme.ForegroundBackground:HeaderStyle.Background ?? theme.SurfaceAlt- Always includes
TextStyle.Bold.
Header itself does not handle input. If a slot contains a focusable visual, that visual behaves normally.
HeaderDemoshows typical title/hint usage with non-wrapping markup visuals.AppChromeTestsverifies header/footer integration when used in aDockLayoutroot.
- Optional slot spacing/padding knobs (can be achieved today by wrapping slot visuals).
- Optional "separator" rendering between slots.
- A "compact" style preset (less bold, different background) as a theme convenience.