pub fn text_editor(args: impl Into<TextEditorArgs>, state: TextEditorState)Expand description
§text_editor
Renders a multi-line, editable text field.
§Usage
Create an interactive text editor for forms, note-taking, or other text input scenarios.
§Parameters
args— configures the editor’s appearance and layout; seeTextEditorArgs.state— aTextEditorStateHandleto manage the editor’s content, cursor, and selection.
§Examples
use std::sync::Arc;
use parking_lot::RwLock;
use tessera_ui::Dp;
use tessera_ui_basic_components::{
text_editor::{text_editor, TextEditorArgsBuilder, TextEditorState},
text::write_font_system,
};
// In a real app, you would manage this state.
let editor_state = TextEditorState::new(Dp(14.0), None);
editor_state.write().editor_mut().set_text_reactive(
"Initial text",
&mut write_font_system(),
&glyphon::Attrs::new().family(glyphon::fontdb::Family::SansSerif),
);
text_editor(
TextEditorArgsBuilder::default()
.padding(Dp(8.0))
.build()
.unwrap(),
editor_state.clone(),
);