Class: RatatuiRuby::Widgets::Cell
- Inherits:
-
Object
- Object
- RatatuiRuby::Widgets::Cell
- Includes:
- CoerceableWidget
- Defined in:
- lib/ratatui_ruby/widgets/cell.rb
Overview
A styled table cell combining content with optional styling.
By default, Table cells are plain strings. For more control over cell styling, wrap the content in a Cell object to apply cell-level background style.
The content can be a String, Text::Span, or Text::Line. The style applies to the entire cell area (background).
Examples
– SPDX-SnippetBegin SPDX-FileCopyrightText: 2026 Kerrick Long SPDX-License-Identifier: MIT-0 ++
# Cell with yellow background
Widgets::Cell.new(content: "Warning", style: Style::Style.new(bg: :yellow))
# Cell with rich text content
Widgets::Cell.new(
content: Text::Line.new(spans: [
Text::Span.new(content: "Error: ", style: Style::Style.new(fg: :red)),
Text::Span.new(content: "Details here")
]),
style: Style::Style.new(bg: :dark_gray)
)
– SPDX-SnippetEnd ++
Instance Method Summary collapse
-
#initialize(content:, style: nil) ⇒ Cell
constructor
Creates a new Cell.
Methods included from CoerceableWidget
Constructor Details
#initialize(content:, style: nil) ⇒ Cell
Creates a new Cell.
- content
-
String, Text::Span, or Text::Line.
- style
-
Style::Style object (optional).
54 55 56 |
# File 'lib/ratatui_ruby/widgets/cell.rb', line 54 def initialize(content:, style: nil) super end |