Skip to main content

BoxElement

Struct BoxElement 

Source
pub struct BoxElement<Msg> {
    pub children: Vec<Element<Msg>>,
    pub style: BoxStyle,
    /* private fields */
}
Expand description

A Flexbox container element that holds child elements.

Use the builder pattern to configure layout and styling:

use a3s_tui::element::{BoxElement, FlexDirection, BorderStyle, Dimension};

let container = BoxElement::<()>::new()
    .direction(FlexDirection::Column)
    .padding(1)
    .gap(1)
    .border(BorderStyle::Rounded)
    .width(Dimension::Percent(100.0));

Fields§

§children: Vec<Element<Msg>>§style: BoxStyle

Implementations§

Source§

impl<Msg> BoxElement<Msg>

Source

pub fn new() -> Self

Source

pub fn row() -> Self

Create a row container (flex-direction: row).

Source

pub fn col() -> Self

Create a column container (flex-direction: column).

Source

pub fn direction(self, d: FlexDirection) -> Self

Source

pub fn child(self, el: Element<Msg>) -> Self

Source

pub fn children(self, els: Vec<Element<Msg>>) -> Self

Source

pub fn padding(self, all: u16) -> Self

Source

pub fn padding_xy(self, x: u16, y: u16) -> Self

Source

pub fn margin(self, all: u16) -> Self

Source

pub fn border(self, style: BorderStyle) -> Self

Source

pub fn border_color(self, c: Color) -> Self

Source

pub fn gap(self, g: u16) -> Self

Source

pub fn flex_grow(self, g: f32) -> Self

Source

pub fn flex_shrink(self, s: f32) -> Self

Source

pub fn flex_basis(self, d: Dimension) -> Self

Source

pub fn width(self, d: Dimension) -> Self

Source

pub fn height(self, d: Dimension) -> Self

Source

pub fn min_width(self, d: Dimension) -> Self

Source

pub fn max_width(self, d: Dimension) -> Self

Source

pub fn min_height(self, d: Dimension) -> Self

Source

pub fn max_height(self, d: Dimension) -> Self

Source

pub fn bg(self, c: Color) -> Self

Source

pub fn align_items(self, a: AlignItems) -> Self

Source

pub fn justify_content(self, j: JustifyContent) -> Self

Source

pub fn overflow(self, o: Overflow) -> Self

Trait Implementations§

Source§

impl<Msg> Default for BoxElement<Msg>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<Msg> Freeze for BoxElement<Msg>

§

impl<Msg> RefUnwindSafe for BoxElement<Msg>
where Msg: RefUnwindSafe,

§

impl<Msg> Send for BoxElement<Msg>
where Msg: Send,

§

impl<Msg> Sync for BoxElement<Msg>
where Msg: Sync,

§

impl<Msg> Unpin for BoxElement<Msg>
where Msg: Unpin,

§

impl<Msg> UnsafeUnpin for BoxElement<Msg>

§

impl<Msg> UnwindSafe for BoxElement<Msg>
where Msg: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.