Skip to main content

33_terminal/
33_terminal.rs

1// Terminal widget is experimental - see View::terminal() docs for limitations.
2
3use telex::prelude::*;
4
5fn app(cx: Scope) -> View {
6    let terminal = terminal!(cx);
7
8    // Spawn bash on first render
9    if !terminal.is_started() {
10        if let Err(e) = terminal.spawn("bash", &[], 80, 24) {
11            eprintln!("Failed to spawn terminal: {}", e);
12        }
13    }
14
15    View::vstack()
16        .child(View::text("Telex Terminal Demo"))
17        .child(View::text(
18            "Press Ctrl+Shift+[ to escape terminal focus, Tab to navigate",
19        ))
20        .child(View::terminal().handle(terminal).build())
21        .build()
22}
23
24fn main() {
25    telex::run(app).unwrap();
26}