Skip to content

Available Width

Returns the content width of the current container, to choose a layout by available space.

ui.available_width
// Side by side when there is room, otherwise one above the other.
let wide = ui.available_width() >= 300.0;
let panel = if wide { ui.row() } else { ui.column() };
panel.w_fill().gap(8).children(|ui| {
ui.text_input(&mut self.query).icon(IconName::Search);
ui.button("Search").primary();
});