class RatatuiRuby::Widgets::ListItem
A styled list item combining content with optional style.
By default, List items are strings. For more control over styling individual rows, wrap the content in a ListItem to apply a style specific to that item.
The content can be a String, Text::Span, or Text::Line. The style applies to the entire row background.
Examples
# Item with red background ListItem.new(content: "Error", style: Style.new(bg: :red)) # Item with styled content ListItem.new( content: Text::Span.new(content: "Status: OK", style: Style.new(fg: :green, modifiers: [:bold])) )
Attributes
The content to display (String, Text::Span, or Text::Line).
Public Class Methods
Source
# File lib/ratatui_ruby/widgets/list_item.rb, line 50 def initialize(content:, style: nil) super end
Creates a new ListItem.
- content
-
String,
Text::Span, orText::Line. - style
-
Styleobject (optional).
Calls superclass method