A tabbed navigation widget. More...
Public Member Functions | |
| void | OnKeyEvent (KeyMsg key, Action< IMsg > dispatch) |
| Left/Right arrows cycle tabs. | |
| void | Render (IRenderContext ctx) |
| Renders the tab bar on row 0 of the allocated region, then delegates Body into the remaining rows. | |
| Tabs () | |
| Object-initializer constructor; all properties default. | |
| Tabs (IReadOnlyList< string > labels, int activeIndex=0, IWidget? body=null, Style? style=null, Style? activeTabStyle=null, Style? inactiveTabStyle=null) | |
| Positional constructor for inline usage. | |
Properties | |
| int | ActiveIndex [get] |
| Zero-based index of the currently active tab. | |
| Style | ActiveTabStyle = Style.Default.Bold(true).Underline(true) [get] |
| Style applied to the active tab label. | |
| IWidget? | Body [get] |
| Content widget to render below the tab bar. | |
| bool | HasFocus [get, set] |
| True when this widget holds keyboard focus. | |
| SizeConstraint | Height = SizeConstraint.Flex(1) [get] |
| Height constraint used by the layout engine. | |
| Style | InactiveTabStyle = Style.Default [get] |
| Style applied to inactive tab labels. | |
| IReadOnlyList< string > | Labels = [] [get] |
| Tab label strings in declaration order. | |
| char | Separator = '│' [get] |
| Character used to separate tab labels in the bar. | |
| Style | Style = Style.Default [get] |
| Visual style for the tab bar row. Inherits theme base style when unset. | |
| SizeConstraint | Width = SizeConstraint.Flex(1) [get] |
| Width constraint used by the layout engine. | |
A tabbed navigation widget.
Renders a tab bar on the first row, and the Body widget in the remaining area.
The caller is responsible for supplying the correct Body for the ActiveIndex (swap it in the model's Update handler when TabChangedMsg arrives).
Key handling when focused:
Tab switching does not move keyboard focus to the body — the model controls focus assignment independently.
| ConsoleForge.Widgets.Tabs.Tabs | ( | IReadOnlyList< string > | labels, |
| int | activeIndex = 0, | ||
| IWidget? | body = null, | ||
| Style? | style = null, | ||
| Style? | activeTabStyle = null, | ||
| Style? | inactiveTabStyle = null ) |
Positional constructor for inline usage.
| labels | Tab label strings. |
| activeIndex | Initially active tab (clamped to valid range). |
| body | Content widget for the active tab. |
| style | Optional tab bar style override. |
| activeTabStyle | Optional style for the active tab label. |
| inactiveTabStyle | Optional style for inactive tab labels. |
| void ConsoleForge.Widgets.Tabs.OnKeyEvent | ( | KeyMsg | key, |
| Action< IMsg > | dispatch ) |
Left/Right arrows cycle tabs.
Number keys 1–9 jump to a specific tab.
Implements ConsoleForge.Layout.IFocusable.
|
get |
Content widget to render below the tab bar.
Typically the widget associated with ActiveIndex. May be null (only the tab bar is drawn).
|
get |
Character used to separate tab labels in the bar.
Default '│'. Set to '\0' to disable separators.