Class: RatatuiRuby::TableState

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

Overview

Mutable state object for Table widgets.

When using Frame::A11yCapture#render_stateful_widget, the State object is the *single source of truth* for selection and scroll offset. Widget properties (selected_row, selected_column, offset) are ignored in stateful mode.

Example

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

@table_state = RatatuiRuby::TableState.new
@table_state.select(1)        # Select second row
@table_state.select_column(0) # Select first column

RatatuiRuby.draw do |frame|
  table = RatatuiRuby::Widgets::Table.new(rows: [...], widths: [...])
  frame.render_stateful_widget(table, frame.area, @table_state)
end

– SPDX-SnippetEnd ++