Skip to main content

grid

Function grid 

Source
pub fn grid() -> Widget
Expand description

WPF’s Grid: a container of rows and columns — give it Widget::rows and Widget::cols (Tracks: pixels, Auto or * shares) and put each child in a cell with Widget::cell / Widget::span. A child fills its cell unless it has Widget::halign / Widget::valign (or an explicit size); Widget::margin insets it.

use yog_ui::widget::{self, GridLength, Track};
let ui = widget::grid()
    .rows([Track::auto(), Track::star(1.0), Track::px(20.0)])
    .cols([GridLength::Px(80.0), GridLength::STAR])
    .child(widget::label("Title").cell(0, 0).span(1, 2))
    .child(widget::scroll_view().cell(1, 0))
    .child(widget::label("Details").cell(1, 1))
    .child(widget::button("OK").cell(2, 1));