Struct egui::Grid [−][src]
pub struct Grid { /* fields omitted */ }
Expand description
A simple grid layout.
The cells are always layed out left to right, top-down. The contents of each cell will be aligned to the left and center.
If you want to add multiple widgets to a cell you need to group them with
Ui::horizontal
, Ui::vertical
etc.
egui::Grid::new("some_unique_id").show(ui, |ui| {
ui.label("First row, first column");
ui.label("First row, second column");
ui.end_row();
ui.label("Second row, first column");
ui.label("Second row, second column");
ui.label("Second row, third column");
ui.end_row();
ui.horizontal(|ui| { ui.label("Same"); ui.label("cell"); });
ui.label("Third row, second column");
ui.end_row();
});
Implementations
If true
, add a subtle background color to every other row.
This can make a table easier to read.
Default: false
.
Set minimum width of each column.
Default: crate::style::Spacing::interact_size
.x
.
Set minimum height of each row.
Default: crate::style::Spacing::interact_size
.y
.
Set soft maximum width (wrapping width) of each column.
Set spacing between columns/rows.
Default: crate::style::Spacing::item_spacing
.
Change which row number the grid starts on.
This can be useful when you have a large Grid
inside of ScrollArea::show_rows
.