Skip to main content

html

Macro html 

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

JSX-like HTML macro that produces a String.

Supports:

  • Standard HTML elements: <div class="foo">...</div>
  • Rust expressions: <p>{self.count}</p> or <p>{some_var}</p>
  • wire:click, wire:submit.prevent, and other wire directives
  • Sub-components via capitalized tags: <Counter /> mounts a wire component inline
  • Void elements: <br />, <input />
  • Fragments: <>{...}</>

§Examples

ⓘ
html! {
    <div class="container">
        <h1>{"Hello"}</h1>
        <p>{self.count}</p>
        <button wire:click={Self::increment}>{"Click me"}</button>
        <Counter />
    </div>
}