Your first application
Create a project, mount App.iru and connect a button to local state.
On this page
Create the project
Run these commands from the Inrux checkout. The destination must not exist.
cargo run -p inrux-cli -- new ../hello-inrux --framework-path . --backend egui
cd ../hello-inrux
cargo run
The scaffold uses local path dependencies. Keep the Inrux checkout while using the generated project. You can choose masonry or gpui instead; review native prerequisites first.
Find the entry point
Cargo starts src/main.rs. The generated entry point includes the compiler output, loads global styles and mounts App.iru. App.iru is the root UI component, not the process entry point.
The scaffold's build.rs calls:
fn main() -> Result<(), Box<dyn std::error::Error>> {
inrux_compiler::build_app("src/App.iru", std::env::var("OUT_DIR")?)?;
Ok(())
}
Cargo compiles the generated Rust and your ordinary modules together. Do not edit generated files under target/.
Replace the root with a counter
Use this complete App.iru in the generated project:
<view>
<Column gap={16.0} padding={24.0}>
<Text text={format!("Count: {}", count)} />
<Button text="Increment" @click={increment} />
</Column>
</view>
<rust>
use inrux::prelude::*;
let count: u32 = 0;
/// Apply the click on the application coordinator.
fn increment(state: &mut State, _: &Context<State>) {
state.count += 1;
}
</rust>
Clicking the button calls increment. The handler updates count, and Inrux publishes the updated component description. You do not write a render loop or an effect to copy this value into Text.
Check and rebuild
cargo check
cargo run
You can use the CLI for a rebuild/restart watcher. It restarts the application and loses in-memory state. Set up VS Code for .iru formatting, completion and navigation.
Next, extract a reusable component using the component contract.