pub fn BasicTextField(__arg0: TextFieldState, __arg1: Modifier) -> NodeIdExpand description
Creates an editable text field.
BasicTextField provides an interactive box that accepts text input through
software or hardware keyboard, but provides no decorations like hint or placeholder.
Use a wrapper component to add decorations.
§Arguments
state- The observable text field state that holds the text contentmodifier- Optional modifiers for styling and layout
§Architecture
Following Jetpack Compose’s BasicTextField pattern, this implementation uses:
- TextFieldElement: Adds text field content as a modifier node
- EmptyMeasurePolicy: Delegates all measurement to modifier nodes
Text content lives in the modifier node (TextFieldModifierNode), not in the measure policy.
§Example
use cranpose_foundation::text::TextFieldState;
use cranpose_ui::{BasicTextField, Modifier};
let state = TextFieldState::new("Hello");
BasicTextField(state.clone(), Modifier::empty());
// Edit the text programmatically
state.edit(|buffer| {
buffer.place_cursor_at_end();
buffer.insert(", World!");
});