counter/
01_counter.rs

1//! Basic Counter Example
2//!
3//! Run with: cargo run --example counter
4
5use tuiuiu::prelude::*;
6
7fn main() -> std::io::Result<()> {
8    // Create reactive state
9    let (count, set_count) = create_signal(0);
10
11    // Build the UI
12    let ui = Box::new()
13        .column()
14        .padding(1)
15        .border_round()
16        .children([
17            Text::new("🐦 Tuiuiu Counter").cyan().bold().build(),
18            Text::new(format!("Count: {}", count.get())).build(),
19            Text::new("↑/↓: change • Esc: exit").gray().dim().build(),
20        ]);
21
22    // Render and get the output
23    let output = tuiuiu::core::renderer::render_to_string(&ui.build(), 40, 10);
24    
25    println!("{}", output);
26    println!();
27    println!("(Interactive mode not yet implemented)");
28    println!("This example demonstrates the component structure.");
29
30    Ok(())
31}