Skip to main content

element

Macro element 

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

Builds a declarative Ratatui Kit element tree.

The syntax is JSX-like while staying Rust-friendly: nested components, props, children, key, first-class if/if let/for/match child control flow, and native Ratatui widget adapters are supported.

element!(Panel(title: "Demo") {
    if show_title {
        Title(text: "Hello")
    } else {
        Title(text: "Hidden")
    }
    for item in items {
        ListItem(label: item, key: item.id)
    }
    widget(Block::default().borders(Borders::ALL))
})