Skip to main content

text_table

Function text_table 

Source
pub fn text_table(cells: Vec<TextTableCell>) -> TextTableBuilder
Expand description

§text_table

Compare text with content-sized columns and accessible merged cells.

§Usage

Compare specifications or settings with row and column headers.

§Parameters

  • cells — text, zero-based grid coordinates, spans and heading roles
  • columns — column count; omitted values infer it from the cells
  • modifier — table sizing and node behavior
  • style, header_style — data and heading typography
  • cell_padding — content insets, defaulting to 24dp horizontally and 16dp vertically
  • color, header_color — body and heading text colors; headings use the body color when no heading color is supplied
  • header_background, divider_color — heading fill and row-rule colors

Columns adapt to measured text. Narrow columns use the text component’s wrapping behavior. Physical-pixel rounding preserves the total allocated width without gaps. Cells are read in row and column order. Grids cannot exceed 1,048,576 positions.

§Examples

use tessera_components::text_table::{TextTableCell, TextTableHeading, text_table};
#[tessera_ui::tessera]
fn comparison() {
    let heading = TextTableCell {
        text: "Size".into(),
        heading: TextTableHeading::Column,
        ..Default::default()
    };
    let value = TextTableCell {
        text: "Medium".into(),
        row: 1,
        ..Default::default()
    };
    text_table(vec![heading, value]).columns(1);
}