Skip to main content

rsx

Macro rsx 

Source
rsx!() { /* proc-macro */ }
Expand description

Build a View from JSX-like syntax.

ⓘ
rsx! {
    <View direction="row" gap={8}>
        <Text>"count: "</Text>
        if *count > 0 {
            <Button on_click={|| *count -= 1}>"-"</Button>
        }
        for (i, todo) in todos.iter().enumerate() {
            <Row key={i} label={todo} />
        }
    </View>
}

Expands to ::egui_reactor::view(|cx| { .. }). Elements are component functions, {expr} embeds any View, "text" is a string literal (bare text is an error), and if / for / match are the real Rust control-flow statements.