Skip to main content

render_scrollbar

Function render_scrollbar 

Source
pub fn render_scrollbar(
    f: &mut Frame<'_>,
    area: Rect,
    total: usize,
    position: usize,
)
Expand description

Builds a widget title Line with an optional keyboard-shortcut digit indicator.

The digit and separator blend into the border line (same color), producing:

┌─ 1 ─ Favorites ────────────────────────────────────────────┐
  • shortcut = Some(1)[1] ─ Label
  • shortcut = NoneLabel

active controls the label style (Theme::tab_active vs Theme::tab_inactive) and the digit+separator color (Theme::border_focused vs Theme::border_unfocused), so they always match the surrounding border.

§Example

// Simple panel title, always active
let title = widget_title("Now Playing", None, true, &theme);

// Panel with shortcut indicator, focus-aware
let title = widget_title("Favorites", Some(1), focused, &theme);

Render a native ratatui vertical scrollbar over the right border of area.

Pass the outer block area (including borders). The scrollbar overlaps the right border column, which is the standard ratatui pattern.

  • total — total number of content rows / lines.
  • position — index of the first visible row (the scroll offset).

Does nothing when all content fits in the visible area.