This crate provides you a layouts components based on Yew Framwork, those components are used to build your view. See API Docs
NOTE: yew-layout is not (yet) prodction ready but is good for use in side projects and internal tools.
Row
to Column
just do it and properties would work
the same, thier behavior would change to match the currnt layout type!.Row
and Column
uses Flexbox behind the scene,
there is no black magic fortunately.The goal for this crate is to provide you a layout types that is used to layout your views, nothing else.
```rust use yewlayout::{Align, AlignRows, Column, CrossAlign, Row, RowProps}; use cssstyle::{unit::px, Gap, Margin, Padding}; use yew::prelude::*;
pub struct App;
impl Component for App { type Message = (); type Properties = ();
fn create(ctx: &Context<Self>) -> Self {
App
}
fn view(&self, ctx: &Context<Self>) -> Html {
html! {
<div style={ "width: 400px; height: 400px; background: silver" }>
<Column align={ Align::Center } cross_align={ CrossAlign::Center }>
<Row align={ Align::Center }
align_rows={ AlignRows::SpaceBetween }
wrap=true
expand_by=3.0
gap={ Gap::from(px(12)) }
padding={ Padding::default().y(px(12)) }
margin={ Margin::default().x(px(20)) }>
{
(0..=11)
.into_iter()
.map(|_| html!{
<div style={ "background: blue; height: 40px; width: 40px;" }></div>
}).collect::<Html>()
}
</Row>
<Row expand_by=1.5>
<h1>{ "This is another row" }</h1>
</Row>
</Column>
</div>
}
}
} ```
this would look like: