Function with_columns

Source
pub fn with_columns(cols: Vec<Column>) -> TableOption
Expand description

Creates an option to set table columns during construction.

This option sets the column structure for the table, defining headers and column widths. This is typically the first option used when creating a new table.

§Arguments

  • cols - Vector of column definitions

§Examples

use bubbletea_widgets::table::{Model, with_columns, Column};

let table = Model::with_options(vec![
    with_columns(vec![
        Column::new("ID", 8),
        Column::new("Name", 25),
        Column::new("Status", 12),
    ]),
]);
assert_eq!(table.columns.len(), 3);