pub struct ContainerStyle {Show 24 fields
pub border: Option<Border>,
pub border_sides: Option<BorderSides>,
pub border_style: Option<Style>,
pub bg: Option<Color>,
pub text_color: Option<Color>,
pub dark_bg: Option<Color>,
pub dark_border_style: Option<Style>,
pub padding: Option<Padding>,
pub margin: Option<Margin>,
pub gap: Option<u32>,
pub row_gap: Option<u32>,
pub col_gap: Option<u32>,
pub grow: Option<u16>,
pub align: Option<Align>,
pub align_self: Option<Align>,
pub justify: Option<Justify>,
pub w: Option<u32>,
pub h: Option<u32>,
pub min_w: Option<u32>,
pub max_w: Option<u32>,
pub min_h: Option<u32>,
pub max_h: Option<u32>,
pub w_pct: Option<u8>,
pub h_pct: Option<u8>,
}Expand description
Reusable container style recipe.
Define once, apply anywhere with [ContainerBuilder::apply]. All fields
are optional — only set fields override the builder’s current values.
Styles compose: apply multiple recipes in sequence, last write wins.
§Example
ⓘ
use slt::{ContainerStyle, Border, Color};
const CARD: ContainerStyle = ContainerStyle::new()
.border(Border::Rounded)
.p(1)
.bg(Color::Indexed(236));
const DANGER: ContainerStyle = ContainerStyle::new()
.bg(Color::Red);
// Apply one or compose multiple:
ui.container().apply(&CARD).col(|ui| { ... });
ui.container().apply(&CARD).apply(&DANGER).col(|ui| { ... });Fields§
§border: Option<Border>§border_sides: Option<BorderSides>§border_style: Option<Style>§bg: Option<Color>§text_color: Option<Color>§dark_bg: Option<Color>§dark_border_style: Option<Style>§padding: Option<Padding>§margin: Option<Margin>§gap: Option<u32>§row_gap: Option<u32>§col_gap: Option<u32>§grow: Option<u16>§align: Option<Align>§align_self: Option<Align>§justify: Option<Justify>§w: Option<u32>§h: Option<u32>§min_w: Option<u32>§max_w: Option<u32>§min_h: Option<u32>§max_h: Option<u32>§w_pct: Option<u8>§h_pct: Option<u8>Implementations§
Source§impl ContainerStyle
impl ContainerStyle
Sourcepub const fn border_sides(self, sides: BorderSides) -> Self
pub const fn border_sides(self, sides: BorderSides) -> Self
Set which border sides to render.
Sourcepub const fn text_color(self, color: Color) -> Self
pub const fn text_color(self, color: Color) -> Self
Set default text color inherited by child text widgets.
Sourcepub const fn align_self(self, value: Align) -> Self
pub const fn align_self(self, value: Align) -> Self
Set per-child cross-axis alignment override.
Trait Implementations§
Source§impl Clone for ContainerStyle
impl Clone for ContainerStyle
Source§fn clone(&self) -> ContainerStyle
fn clone(&self) -> ContainerStyle
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ContainerStyle
impl Debug for ContainerStyle
Source§impl Default for ContainerStyle
impl Default for ContainerStyle
Source§fn default() -> ContainerStyle
fn default() -> ContainerStyle
Returns the “default value” for a type. Read more
impl Copy for ContainerStyle
Auto Trait Implementations§
impl Freeze for ContainerStyle
impl RefUnwindSafe for ContainerStyle
impl Send for ContainerStyle
impl Sync for ContainerStyle
impl Unpin for ContainerStyle
impl UnsafeUnpin for ContainerStyle
impl UnwindSafe for ContainerStyle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more