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

type Children = ChildrenRenderer<Html>;

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.

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(Clone, Properties)]
struct WrapperProps {
    children: Children,
}

impl Component for Wrapper {
    // ...
    fn view(&self) -> Html {
        html! {
            <div id="container">
                { self.props.children.render() }
            </div>
        }
    }
}