pub struct Table {Show 14 fields
pub common: Common,
pub header: Option<Row>,
pub rows: Vec<Row>,
pub footer: Option<Row>,
pub widths: Vec<Constraint>,
pub column_spacing: Option<u16>,
pub row_highlight_style: Option<Style>,
pub highlight_symbol: Option<String>,
pub highlight_spacing: Option<HighlightSpacing>,
pub state: Option<ListState>,
pub sticky: Option<Sticky>,
pub scrollbar: Option<bool>,
pub on_select: Option<ActionId>,
pub on_activate: Option<ActionId>,
}Expand description
ratatui Table (§4.5.1). Column widths are solved horizontally like a Layout.
Fields§
§common: CommonCommon node props (key, style, block, fallback).
header: Option<Row>Header row.
rows: Vec<Row>Body rows (≤ 5 000, §4.8).
Footer row.
widths: Vec<Constraint>One width constraint per column.
column_spacing: Option<u16>Gap between columns (default 1).
row_highlight_style: Option<Style>Selected-row style.
highlight_symbol: Option<String>Prefix drawn before the selected row.
highlight_spacing: Option<HighlightSpacing>Space reserved for the highlight symbol.
state: Option<ListState>Selection / offset state (wins when it changes, §4.6).
sticky: Option<Sticky>GUI extra: sticky first column.
scrollbar: Option<bool>GUI extra: native scrollbar.
on_select: Option<ActionId>Action on selection change (row key).
on_activate: Option<ActionId>Action on Enter (row key).
Implementations§
Source§impl Table
impl Table
Sourcepub fn new(
rows: impl IntoIterator<Item = impl Into<Row>>,
widths: impl IntoIterator<Item = Constraint>,
) -> Self
pub fn new( rows: impl IntoIterator<Item = impl Into<Row>>, widths: impl IntoIterator<Item = Constraint>, ) -> Self
A table from rows and column widths.
Sets the footer row.
Sourcepub fn widths(self, widths: impl IntoIterator<Item = Constraint>) -> Self
pub fn widths(self, widths: impl IntoIterator<Item = Constraint>) -> Self
Sets the column width constraints.
Sourcepub fn column_spacing(self, spacing: u16) -> Self
pub fn column_spacing(self, spacing: u16) -> Self
Sets the column gap.
Sourcepub fn row_highlight_style(self, style: Style) -> Self
pub fn row_highlight_style(self, style: Style) -> Self
Sets the selected-row style.
Sourcepub fn highlight_symbol(self, symbol: impl Into<String>) -> Self
pub fn highlight_symbol(self, symbol: impl Into<String>) -> Self
Sets the prefix drawn before the selected row.
Sourcepub fn highlight_spacing(self, spacing: HighlightSpacing) -> Self
pub fn highlight_spacing(self, spacing: HighlightSpacing) -> Self
Sets the highlight-symbol spacing policy.
Sourcepub fn on_activate(self, action: impl Into<ActionId>) -> Self
pub fn on_activate(self, action: impl Into<ActionId>) -> Self
Sets the activate action.