Expand description
A Ratatui table widget whose cells can contain any widget.
This crate provides a Table that works exactly like the Table widget built into Ratatui,
except that each Cell can hold any widget (e.g. Paragraph, Block, Gauge, List, or
even another Table) rather than only Text.
The API mirrors the built-in table, and it uses the same TableState and
HighlightSpacing types, so switching over is usually just a matter of changing imports:
-use ratatui::widgets::{Cell, Row, Table, TableState};
+use ratatui::widgets::TableState;
+use ratatui_widgettable::{Cell, Row, Table};§Example
use ratatui::layout::Constraint;
use ratatui::widgets::{Block, Gauge, Paragraph, Wrap};
use ratatui_widgettable::{Cell, Row, Table};
let rows = [Row::new(vec![
Cell::from("Build"),
Cell::new(
Paragraph::new("Compiling a very long list of crates, this might take a while")
.wrap(Wrap { trim: true }),
),
Cell::new(Gauge::default().percent(42)),
])
.height(3)];
let widths = [
Constraint::Length(8),
Constraint::Fill(1),
Constraint::Length(20),
];
let table = Table::new(rows, widths)
.header(Row::new(vec!["Step", "Details", "Progress"]))
.block(Block::bordered().title("Jobs"));Structs§
- Cell
- A
Cellcontains the widget to be displayed in aRowof aTable. - Row
- A single row of data to be displayed in a
Tablewidget. - Table
- A widget to display data in formatted columns, where each cell can contain any widget.
- Table
State - State of a
Tablewidget
Enums§
- Highlight
Spacing - This option allows the user to configure the “highlight symbol” column width spacing