StatusBar
The StatusBar widget displays status information in three sections: left, center, and right. It’s commonly used at the bottom of applications to show current state, messages, or help text.
Overview
Section titled “Overview”StatusBar provides a convenient way to display status information with automatic text positioning. It’s typically 1 line tall and spans the width of the application.
Properties
Section titled “Properties”LeftText (string)
Section titled “LeftText (string)”Text displayed on the left side of the status bar.
statusBar.LeftText = "Ready";CenterText (string)
Section titled “CenterText (string)”Text displayed in the center of the status bar.
statusBar.CenterText = "Processing...";RightText (string)
Section titled “RightText (string)”Text displayed on the right side of the status bar.
statusBar.RightText = "ESC to exit";StatusBarBackground (Color)
Section titled “StatusBarBackground (Color)”The background color of the status bar.
statusBar.StatusBarBackground = Color.DarkGray;StatusBarForeground (Color)
Section titled “StatusBarForeground (Color)”The foreground (text) color of the status bar.
statusBar.StatusBarForeground = Color.White;Methods
Section titled “Methods”SetStatus(string? left, string? center, string? right)
Section titled “SetStatus(string? left, string? center, string? right)”Sets all status bar text at once. Pass null to leave a section unchanged.
statusBar.SetStatus(left: "Ready", center: "Processing", right: "ESC to exit");Usage Example
Section titled “Usage Example”var statusBar = new StatusBar{ X = 0, Y = Console.WindowHeight - 1, Width = Console.WindowWidth, Height = 1, LeftText = "Elaris v0.1.0", CenterText = "Ready", RightText = "ESC to exit", StatusBarBackground = Color.DarkGray, StatusBarForeground = Color.White};
// Update status dynamicallystatusBar.CenterText = "Processing file...";statusBar.LeftText = "File: example.txt";Text Truncation
Section titled “Text Truncation”If text is too long for its section (more than 1/3 of the width), it will be automatically truncated to fit.
Common Patterns
Section titled “Common Patterns”Application Status
Section titled “Application Status”statusBar.LeftText = $"Lines: {lineCount}";statusBar.CenterText = "Ready";statusBar.RightText = $"Cursor: {cursorX},{cursorY}";Progress Indicator
Section titled “Progress Indicator”statusBar.CenterText = $"Progress: {percentage}%";Help Text
Section titled “Help Text”statusBar.RightText = "F1: Help | ESC: Exit";Related Widgets
Section titled “Related Widgets”- Container - Base container class
- ResponsiveContainer - For responsive layouts