Class: RatatuiRuby::Widgets::Scrollbar
- Inherits:
-
Object
- Object
- RatatuiRuby::Widgets::Scrollbar
- Includes:
- CoerceableWidget
- Defined in:
- lib/ratatui_ruby/widgets/scrollbar.rb
Overview
Visualizes the scroll state of a viewport.
Content overflows. Users get lost in long lists without landmarks. They need to know where they are and how much is left.
This widget maps your context. It draws a track and a thumb, representing your current position relative to the total length.
Overlay it on top of lists, paragraphs, or tables to provide spatial awareness.
Example
Run the interactive demo from the terminal:
ruby examples//app.rb
Instance Method Summary collapse
-
#initialize(content_length:, position:, orientation: :vertical, thumb_symbol: "█", thumb_style: nil, track_symbol: nil, track_style: nil, begin_symbol: nil, begin_style: nil, end_symbol: nil, end_style: nil, style: nil, block: nil) ⇒ Scrollbar
constructor
Creates a new Scrollbar.
Methods included from CoerceableWidget
Constructor Details
#initialize(content_length:, position:, orientation: :vertical, thumb_symbol: "█", thumb_style: nil, track_symbol: nil, track_style: nil, begin_symbol: nil, begin_style: nil, end_symbol: nil, end_style: nil, style: nil, block: nil) ⇒ Scrollbar
Creates a new Scrollbar.
- content_length
-
Integer.
- position
-
Integer.
- orientation
-
Symbol (default:
:vertical). - thumb_symbol
-
String (default:
"█"). - thumb_style
-
Style (optional).
- track_symbol
-
String (optional).
- track_style
-
Style (optional).
- begin_symbol
-
String (optional).
- begin_style
-
Style (optional).
- end_symbol
-
String (optional).
- end_style
-
Style (optional).
- style
-
Style (optional).
- block
-
Block (optional).
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/ratatui_ruby/widgets/scrollbar.rb', line 114 def initialize( content_length:, position:, orientation: :vertical, thumb_symbol: "█", thumb_style: nil, track_symbol: nil, track_style: nil, begin_symbol: nil, begin_style: nil, end_symbol: nil, end_style: nil, style: nil, block: nil ) super( content_length: Integer(content_length), position: Integer(position), orientation:, thumb_symbol:, thumb_style:, track_symbol:, track_style:, begin_symbol:, begin_style:, end_symbol:, end_style:, style:, block: ) end |
