Class: RatatuiRuby::ScrollbarState

Inherits:
Object
  • Object
show all
Defined in:
lib/ratatui_ruby/scrollbar_state.rb

Overview

Mutable state object for Scrollbar widgets.

When using Frame::A11yCapture#render_stateful_widget, the State object is the *single source of truth* for position and content length. Widget properties (position, content_length) are ignored in stateful mode.

Example

– SPDX-SnippetBegin SPDX-FileCopyrightText: 2026 Kerrick Long SPDX-License-Identifier: MIT-0 ++

@scrollbar_state = RatatuiRuby::ScrollbarState.new(100)
@scrollbar_state.position = 25

RatatuiRuby.draw do |frame|
  scrollbar = RatatuiRuby::Scrollbar.new(orientation: :vertical_right)
  frame.render_stateful_widget(scrollbar, frame.area, @scrollbar_state)
end

– SPDX-SnippetEnd ++