htmlrs

Crates.iohtmlrs
lib.rshtmlrs
version0.1.2
sourcesrc
created_at2024-07-18 04:37:27.289529
updated_at2024-07-18 06:02:47.073165
descriptionhtmlrs
homepagehttps://github.com/MNThomson/htmlrs
repository
max_upload_size
id1306964
size44,559
Max Thomson (MNThomson)

documentation

README

htmlrs

github crates.io

Usage

cargo add htmlrs

Take a look at the examples folder!

use htmlrs::{component, html, view, Children, IntoView};

#[component]
fn Text(text: String) -> impl IntoView {
    view! {<span>{text}</span>}
}

#[component]
fn TextInto(#[prop(into)] text: String) -> impl IntoView {
    view! {<span>{text}</span>}
}

#[component]
fn Page(children: Children) -> impl IntoView {
    view! {<div>{children()}</div>}
}

fn main() {
    let page = html! {
        <Page>
            <Text text="hello".to_string() />
            <TextInto text="world" />
        </Page>
    };
    println!("{}", page);
    assert_eq!(page, "<div><span>hello</span><span>world</span></div>")
}
Commit count: 0

cargo fmt