pub fn text(content: impl Into<TextContent>) -> TextBuilderExpand description
§text
Renders a block of text with a single, uniform style.
§Usage
Display simple text content. For more complex styling or editing, see other components.
§Parameters
content— required text content to display.modifier— modifier chain applied to the text node; caller semantics remain intact. The default label is the content and the default role is a label, unless supplied by the modifier.color— optional text color override.style— optional text style override for typography presets.size— optional font size override.line_height— optional line height override.single_line— keep text on one line and ellipsize overflow.accessibility_label— optional label override, taking precedence over modifier semantics and displayed content.accessibility_description— optional description override, taking precedence over modifier semantics.
§Examples
use tessera_components::text::text;
use tessera_ui::{Color, Dp, tessera};
#[tessera]
fn demo() {
text("Hello, world!")
.color(Color::new(0.2, 0.5, 0.8, 1.0))
.style(tessera_components::theme::TextStyle {
font_size: Dp(32.0),
line_height: Some(Dp(40.0)),
..Default::default()
});
}