Incular logoIncular
API ReferenceLayout Widgets

Table

Row-major max-content grid with column count and gutters.

Table is a row-major max-content grid. columns clamps to max(1); spacings clamp to max(0.0).

Props

Prop

Type

Construction

A settings table — copy, paste, and run:

use incular::prelude::*;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let app = Application::new(|_cx| {
        Container::builder()
            .padding(EdgeInsets::all(24.0))
            .alignment(Alignment::CENTER)
            .child(
                Table::new(
                    2,
                    Vec::<Widget>::from([
                        Text::new("Name").into(),
                        Text::new("Value").into(),
                        Text::new("Theme").into(),
                        Text::new("Dark").into(),
                    ]),
                )
                .column_spacing(16.0)
                .row_spacing(8.0),
            )
            .build()
            .into()
    })?;
    incular::run(app)?;
    Ok(())
}

Methods

pub fn new(columns: usize, children: impl IntoIterator<Item = impl Into<Widget>>) -> Self
pub fn column_spacing(mut self, spacing: f32) -> Self
pub fn row_spacing(mut self, spacing: f32) -> Self

Children fill row by row; the last row may be partial. For lazy or scrollable grids use GridView instead.

TableCell wraps one cell with an optional vertical alignment (vertical_alignment(CrossAxisAlignment), currently a child passthrough).

Related: Wrap.

On this page