[−][src]Function sauron_native::builder::element
pub fn element<T, EVENT, MSG>(
tag: T,
attrs: Vec<Attribute<EVENT, MSG>>,
children: Vec<Node<T, EVENT, MSG>>
) -> Node<T, EVENT, MSG>
Create an element
use sauron_vdom::{ builder::*, Callback, Event, Node, }; fn main() { let old: Node<&'static str, (), ()> = element( "div", vec![ attr("class", "some-class"), attr("id", "some-id"), on("click", |_| { println!("clicked"); }), attr("data-id", 1111), on("mouseover", |_| { println!("i've been clicked"); }), ], vec![element("div", vec![], vec![text("Hello world!")])], ); }