iced::widget

Module text_input

Source
Expand description

Text inputs display fields that can be filled with text.

§Example

use iced::widget::text_input;

struct State {
   content: String,
}

#[derive(Debug, Clone)]
enum Message {
    ContentChanged(String)
}

fn view(state: &State) -> Element<'_, Message> {
    text_input("Type something here...", &state.content)
        .on_input(Message::ContentChanged)
        .into()
}

fn update(state: &mut State, message: Message) {
    match message {
        Message::ContentChanged(content) => {
            state.content = content;
        }
    }
}

Modules§

  • Track the cursor of a text input.

Structs§

Enums§

Constants§

Traits§

Functions§

Type Aliases§