Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

StatusBar

StatusBar preview

StatusBar — a horizontal chrome bar at the bottom of a window for status information.

Public types

KindName
constSTATUS_BAR_HEIGHT — StatusBar design tokens
constSTATUS_BAR_PADDING_HORIZONTAL
fnstatus_bar_padding_horizontal — STATUS_BAR_PADDING_HORIZONTAL scaled by the density's spacing_factor (1.00 / 1.15 / 1.30)
constSTATUS_BAR_ITEM_GAP
fnstatus_bar_item_gap — STATUS_BAR_ITEM_GAP scaled by the density's spacing_factor (1.00 / 1.15 / 1.30)
structStatusBar — A status bar for displaying information at the bottom of a window

Public functions

StatusBar

Detailed description

The bar publishes Role::Status so assistive technology can discover it as a status landmark. It is not a live region by default — use announce_changes(true) only for bars that surface transient messages worth reading aloud (e.g. "Saved"), not for bars showing continuous data like cursor position or zoom level that would flood the screen reader. Visual chrome (background, border, corner radius) is delegated to an inner Panel.

#![allow(unused)]
fn main() {
use teksilo_widgets::StatusBar;
use teksilo_widgets::primitives::TextWidget;
use teksilo_i18n::lit;
let _bar = StatusBar::new()
    .child(TextWidget::new(lit!("Ln 1, Col 1")))
    .announce_changes(false);
}

Density

The picture above is the widget at TargetDensity::Compact, the mouse-and-keyboard ladder. Below is the same subject on the same canvas with only the ladder changed, so what moves is the density and nothing else — where the subject no longer fits, that is what the denser targets cost it at that size. See docs/density-and-targets.md.

Touch

StatusBar at Touch density

API reference

📖 Full rustdoc API for this module

pub const STATUS_BAR_HEIGHT

Import: use teksilo::widgets::status_bar::STATUS_BAR_HEIGHT;

StatusBar design tokens.

#![allow(unused)]
fn main() {
pub const STATUS_BAR_HEIGHT: f32 = 22.0;
}

pub const STATUS_BAR_PADDING_HORIZONTAL

Import: use teksilo::widgets::status_bar::STATUS_BAR_PADDING_HORIZONTAL;

#![allow(unused)]
fn main() {
pub const STATUS_BAR_PADDING_HORIZONTAL: f32 = 8.0;
}

pub fn status_bar_padding_horizontal(...)

Import: use teksilo::widgets::status_bar::status_bar_padding_horizontal;

STATUS_BAR_PADDING_HORIZONTAL scaled by the density's spacing_factor (1.00 / 1.15 / 1.30).

#![allow(unused)]
fn main() {
pub fn status_bar_padding_horizontal(tokens: &InputTokens) -> f32;
}

pub const STATUS_BAR_ITEM_GAP

Import: use teksilo::widgets::status_bar::STATUS_BAR_ITEM_GAP;

#![allow(unused)]
fn main() {
pub const STATUS_BAR_ITEM_GAP: f32 = 2.0;
}

pub fn status_bar_item_gap(...)

Import: use teksilo::widgets::status_bar::status_bar_item_gap;

STATUS_BAR_ITEM_GAP scaled by the density's spacing_factor (1.00 / 1.15 / 1.30).

#![allow(unused)]
fn main() {
pub fn status_bar_item_gap(tokens: &InputTokens) -> f32;
}

pub struct StatusBar

Import: use teksilo::widgets::StatusBar;

A status bar for displaying information at the bottom of a window.

Visual chrome is delegated to an inner Panel. By default the bar uses the SurfaceRole::Sunken surface with square corners (a bar spanning the window edge shouldn't be rounded); override the surface with background, the corners with corner_radius, or add a frame with border_color / border_width.

Accessibility: the bar publishes Role::Status (→ AT-SPI StatusBar, macOS AXApplicationStatus, Windows UIA_StatusBarControlTypeId) so it is discoverable as a status landmark. It is not a live region by default — a status bar showing continuously-changing data (cursor position, zoom level, word count) would otherwise flood the screen reader. Call announce_changes(true) for a bar that surfaces transient messages worth reading aloud ("Saved").

#![allow(unused)]
fn main() {
pub struct StatusBar { /* fields */ }
}

Methods

pub fn new() -> Self

Create an empty status bar with default styling (SurfaceRole::Sunken, square corners, no live region).

pub fn child(mut self, widget: impl teksilo_core::IntoTeksiChild) -> Self

Add an inline child widget (deferred insertion).

pub fn children( self, iter: impl IntoIterator<Item = impl teksilo_core::IntoTeksiChild>, ) -> Self

Add several inline children from an iterator.

The loop form of child: one call where a chain of .child(..) would otherwise repeat per element.

pub fn child_opt(self, widget: Option<impl teksilo_core::IntoTeksiChild>) -> Self

Attach widget when it is Some, and do nothing when it is None.

The conditional-child form. teksu!'s if without an else lowers to this, and it is what cond.then(|| w) is for in a builder chain. None adds no arena node, so nothing is laid out, painted, or published to the accessibility tree, and a stack applies no spacing around it.

pub fn background(mut self, color: impl Into<ColorProp>) -> Self

Override the background surface. Accepts Color, a SurfaceRole, or a Signal<Color>. Default (unset) is SurfaceRole::Sunken.

pub fn corner_radius(mut self, radius: impl Into<Prop<f32>>) -> Self

Override the corner radius. Accepts a static f32 or a reactive Signal<f32>. Default (unset) is 0.0 — square corners.

pub fn border_color(mut self, color: impl Into<ColorProp>) -> Self (default: None)

Override the border color. Accepts Color, a BorderRole, or a Signal<Color>. Only painted when border_width > 0.

pub fn border_width(mut self, width: impl Into<Prop<f32>>) -> Self

Override the border width. Accepts a static f32 or a reactive Signal<f32>. Default (unset) is 0.0 — no border.

pub fn name(mut self, name: impl Into<Prop<String>>) -> Self

Override the accessible name announced for the bar. Accepts a static string, a Signal<String>, or a tr!(...) LocalizedString (locale-reactive). Default (unset) is the localized "Status".

pub fn announce_changes(mut self, announce: bool) -> Self

Control whether content changes are announced by assistive tech.

Default false: the Role::Status landmark is published (still navigable) but the bar is not a live region, so continuously-changing data (cursor position, zoom, word count) doesn't flood the screen reader. Set true to make it a Live::Polite region for bars that surface transient messages worth reading aloud ("Saved").