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.
- Text
Input - A field that can be filled with text.
- Value
- The value of a
TextInput
.
Enums§
Constants§
- DEFAULT_
PADDING - The default
Padding
of aTextInput
.
Traits§
Functions§
- default
- The default style of a
TextInput
. - focus
- Produces a
Task
that focuses theTextInput
with the givenId
. - move_
cursor_ to - Produces a
Task
that moves the cursor of theTextInput
with the givenId
to the provided position. - move_
cursor_ to_ end - Produces a
Task
that moves the cursor of theTextInput
with the givenId
to the end. - move_
cursor_ to_ front - Produces a
Task
that moves the cursor of theTextInput
with the givenId
to the front. - select_
all - Produces a
Task
that selects all the content of theTextInput
with the givenId
.