class RatatuiRuby::Tabs
Displays a tab bar for navigation.
Screen real estate is limited. You cannot show everything at once. Segregating content into views is necessary for complex apps.
This widget separates dimensions. It displays a row of titles, indicating which view is active.
Use it at the top of your interface to switch between major modes or contexts.
Example
Run the interactive demo from the terminal:
ruby examples/widget_tabs_demo/app.rb
Attributes
Optional wrapping block.
Separator string between tabs.
Style for the selected tab title.
Left padding for the tabs area (Integer, default: 0).
Right padding for the tabs area (Integer, default: 0).
Index of the active tab.
Base style for the tabs area.
Tab titles (Array of Strings).
Public Class Methods
Source
# File lib/ratatui_ruby/schema/tabs.rb, line 65 def initialize(titles: [], selected_index: 0, block: nil, divider: nil, highlight_style: nil, style: nil, padding_left: 0, padding_right: 0) super( titles:, selected_index: Integer(selected_index), block:, divider:, highlight_style:, style:, padding_left: Integer(padding_left), padding_right: Integer(padding_right) ) end
Creates a new Tabs widget.
- titles
-
Array of Strings/Lines.
selected_index-
Integer (default: 0).
- block
-
Block(optional). - divider
-
String (optional).
highlight_style-
Style(optional). - style
-
Style(optional). padding_left-
Integer (default: 0).
padding_right-
Integer (default: 0).
Public Instance Methods
Source
# File lib/ratatui_ruby/schema/tabs.rb, line 79 def width RatatuiRuby._tabs_width(self) end
Returns the total width of the tabs.
