dashboard/
02_dashboard.rs

1//! Dashboard Example
2//!
3//! Run with: cargo run --example dashboard
4
5use tuiuiu::prelude::*;
6
7fn main() -> std::io::Result<()> {
8    let ui = Box::new()
9        .column()
10        .padding(1)
11        .gap(1)
12        .border_round()
13        .children([
14            Text::new("📊 Dashboard").cyan().bold().build(),
15            
16            Box::new()
17                .row()
18                .gap(2)
19                .children([
20                    Box::new()
21                        .column()
22                        .padding(1)
23                        .border(tuiuiu::utils::border::BorderStyle::Single)
24                        .children([
25                            Text::new("CPU").yellow().build(),
26                            Text::new("45%").green().build(),
27                        ])
28                        .build(),
29                    
30                    Box::new()
31                        .column()
32                        .padding(1)
33                        .border(tuiuiu::utils::border::BorderStyle::Single)
34                        .children([
35                            Text::new("Memory").yellow().build(),
36                            Text::new("2.1 GB").cyan().build(),
37                        ])
38                        .build(),
39                ])
40                .build(),
41            
42            Text::new("Press q to quit").gray().dim().build(),
43        ]);
44
45    let output = tuiuiu::core::renderer::render_to_string(&ui.build(), 50, 15);
46    println!("{}", output);
47
48    Ok(())
49}