[][src]Type Definition yew::html::Children

type Children<T> = ChildrenRenderer<Html<T>>;

A type used for accepting children elements in Component::Properties.

Example

model.rs

In this example, the Wrapper component is used to wrap other elements.


#[derive(Properties)]
html!{
  <Wrapper>
    <h4> {"Hi"} </h4>
    <div> {"Hello"} </div>
  </Wrapper>
}

wrapper.rs

The Wrapper component must define a children property in order to wrap other elements. The children property can be used to render the wrapped elements.

#[derive(Properties)]
struct WrapperProps {
  children: Children<Wrapper>,
}
impl Renderable<Wrapper> for Wrapper {
   fn view(&self) -> Html<Wrapper> {
       html!{
           <div id="container">
               { self.props.children.view() }
           </div>
       }
   }
}