Skip to main content

text_input

Function text_input 

Source
pub fn text_input<State, F>(
    value: impl Into<String>,
    on_change: F,
) -> TextInputView<State>
where State: 'static, F: Fn(&mut State, String) + 'static,
Expand description

Create a controlled text field showing value that fires on_change(state, new_text) on every edit.

The field is a controlled component: it reports the requested text through on_change and adopts the app-confirmed value on the next rebuild — it is never its own source of truth. Add a submit handler with TextInputView::on_submit and a placeholder with TextInputView::placeholder.