pub struct ContainerBuilder<'a> { /* private fields */ }Expand description
Fluent builder for configuring containers before calling .col() or .row().
Obtain one via Context::container or Context::bordered. Chain the
configuration methods you need, then finalize with .col(|ui| { ... }) or
.row(|ui| { ... }).
§Example
use slt::{Border, Color};
ui.container()
.border(Border::Rounded)
.pad(1)
.grow(1)
.col(|ui| {
ui.text("inside a bordered, padded, growing column");
});Implementations§
Source§impl<'a> ContainerBuilder<'a>
impl<'a> ContainerBuilder<'a>
Sourcepub fn border_top(self, show: bool) -> Self
pub fn border_top(self, show: bool) -> Self
Show or hide the top border.
Sourcepub fn border_right(self, show: bool) -> Self
pub fn border_right(self, show: bool) -> Self
Show or hide the right border.
Sourcepub fn border_bottom(self, show: bool) -> Self
pub fn border_bottom(self, show: bool) -> Self
Show or hide the bottom border.
Sourcepub fn border_left(self, show: bool) -> Self
pub fn border_left(self, show: bool) -> Self
Show or hide the left border.
Sourcepub fn border_sides(self, sides: BorderSides) -> Self
pub fn border_sides(self, sides: BorderSides) -> Self
Set which border sides are visible.
Sourcepub fn border_style(self, style: Style) -> Self
pub fn border_style(self, style: Style) -> Self
Set the style applied to the border characters.
pub fn bg(self, color: Color) -> Self
Sourcepub fn min_w(self, value: u32) -> Self
pub fn min_w(self, value: u32) -> Self
Set the minimum width constraint. Shorthand for min_width.
Sourcepub fn max_w(self, value: u32) -> Self
pub fn max_w(self, value: u32) -> Self
Set the maximum width constraint. Shorthand for max_width.
Sourcepub fn min_h(self, value: u32) -> Self
pub fn min_h(self, value: u32) -> Self
Set the minimum height constraint. Shorthand for min_height.
Sourcepub fn max_h(self, value: u32) -> Self
pub fn max_h(self, value: u32) -> Self
Set the maximum height constraint. Shorthand for max_height.
Sourcepub fn min_height(self, value: u32) -> Self
pub fn min_height(self, value: u32) -> Self
Set the minimum height constraint in rows.
Sourcepub fn max_height(self, value: u32) -> Self
pub fn max_height(self, value: u32) -> Self
Set the maximum height constraint in rows.
Sourcepub fn h_pct(self, pct: u8) -> Self
pub fn h_pct(self, pct: u8) -> Self
Set height as a percentage (1-100) of the parent container.
Sourcepub fn constraints(self, constraints: Constraints) -> Self
pub fn constraints(self, constraints: Constraints) -> Self
Set all size constraints at once using a Constraints value.
Sourcepub fn grow(self, grow: u16) -> Self
pub fn grow(self, grow: u16) -> Self
Set the flex-grow factor. 1 means the container expands to fill available space.
Sourcepub fn center(self) -> Self
pub fn center(self) -> Self
Center children on the cross axis. Shorthand for .align(Align::Center).
Sourcepub fn space_between(self) -> Self
pub fn space_between(self) -> Self
Distribute children with equal space between; first at start, last at end.
Sourcepub fn space_around(self) -> Self
pub fn space_around(self) -> Self
Distribute children with equal space around each child.
Sourcepub fn space_evenly(self) -> Self
pub fn space_evenly(self) -> Self
Distribute children with equal space between all children and edges.
Sourcepub fn title(self, title: impl Into<String>) -> Self
pub fn title(self, title: impl Into<String>) -> Self
Set a plain-text title rendered in the top border.
Sourcepub fn title_styled(self, title: impl Into<String>, style: Style) -> Self
pub fn title_styled(self, title: impl Into<String>, style: Style) -> Self
Set a styled title rendered in the top border.
Sourcepub fn scroll_offset(self, offset: u32) -> Self
pub fn scroll_offset(self, offset: u32) -> Self
Set the vertical scroll offset in rows. Used internally by Context::scrollable.
Sourcepub fn col(self, f: impl FnOnce(&mut Context)) -> Response
pub fn col(self, f: impl FnOnce(&mut Context)) -> Response
Finalize the builder as a vertical (column) container.
The closure receives a &mut Context for rendering children.
Returns a Response with click/hover state for this container.