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§

cursor
Track the cursor of a text input.

Structs§

Cursor
The cursor of a text input.
Icon
The content of the Icon.
Id
The identifier of a TextInput.
State
The state of a TextInput.
Style
The appearance of a text input.
TextInput
A field that can be filled with text.
Value
The value of a TextInput.

Enums§

Side
The side of a TextInput.
Status
The possible status of a TextInput.

Constants§

DEFAULT_PADDING
The default Padding of a TextInput.

Traits§

Catalog
The theme catalog of a TextInput.

Functions§

default
The default style of a TextInput.
focus
Produces a Task that focuses the TextInput with the given Id.
move_cursor_to
Produces a Task that moves the cursor of the TextInput with the given Id to the provided position.
move_cursor_to_end
Produces a Task that moves the cursor of the TextInput with the given Id to the end.
move_cursor_to_front
Produces a Task that moves the cursor of the TextInput with the given Id to the front.
select_all
Produces a Task that selects all the content of the TextInput with the given Id.

Type Aliases§

StyleFn
A styling function for a TextInput.