pub struct Text { /* private fields */ }Expand description
Text component builder.
Implementations§
Source§impl Text
impl Text
Sourcepub fn new(content: impl Into<String>) -> Self
pub fn new(content: impl Into<String>) -> Self
Create a new text component.
Examples found in repository?
examples/01_counter.rs (line 17)
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}More examples
examples/02_dashboard.rs (line 14)
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}Sourcepub fn fg(self, color: NamedColor) -> Self
pub fn fg(self, color: NamedColor) -> Self
Set text color by name.
Sourcepub fn background(self, color: Color) -> Self
pub fn background(self, color: Color) -> Self
Set background color.
Sourcepub fn bg(self, color: NamedColor) -> Self
pub fn bg(self, color: NamedColor) -> Self
Set background color by name.
Sourcepub fn green(self) -> Self
pub fn green(self) -> Self
Green text.
Examples found in repository?
examples/02_dashboard.rs (line 26)
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}Sourcepub fn yellow(self) -> Self
pub fn yellow(self) -> Self
Yellow text.
Examples found in repository?
examples/02_dashboard.rs (line 25)
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}Sourcepub fn cyan(self) -> Self
pub fn cyan(self) -> Self
Cyan text.
Examples found in repository?
examples/01_counter.rs (line 17)
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}More examples
examples/02_dashboard.rs (line 14)
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}Sourcepub fn gray(self) -> Self
pub fn gray(self) -> Self
Gray text.
Examples found in repository?
examples/01_counter.rs (line 19)
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}More examples
examples/02_dashboard.rs (line 42)
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}Sourcepub fn bold(self) -> Self
pub fn bold(self) -> Self
Make text bold.
Examples found in repository?
examples/01_counter.rs (line 17)
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}More examples
examples/02_dashboard.rs (line 14)
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}Sourcepub fn strikethrough(self) -> Self
pub fn strikethrough(self) -> Self
Make text strikethrough.
Sourcepub fn dim(self) -> Self
pub fn dim(self) -> Self
Make text dim.
Examples found in repository?
examples/01_counter.rs (line 19)
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}More examples
examples/02_dashboard.rs (line 42)
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}Sourcepub fn build(self) -> VNode
pub fn build(self) -> VNode
Build into a VNode.
Examples found in repository?
examples/01_counter.rs (line 17)
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}More examples
examples/02_dashboard.rs (line 14)
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}Trait Implementations§
Auto Trait Implementations§
impl Freeze for Text
impl RefUnwindSafe for Text
impl Send for Text
impl Sync for Text
impl Unpin for Text
impl UnwindSafe for Text
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more