Available on crate feature
input only.Expand description
Single-line text inputs with an optional leading icon.
Besides iced’s own editing keys (select all, copy, cut, paste, moving by
word, Home and End), inputs undo and redo, delete a word with
Ctrl+Backspace and Ctrl+Delete, and keep Escape to themselves: see
Shortcut and default_keymap. Pass a Shortcuts set to
Input::shortcuts to switch some or all of them off, and a keymap to
Input::keymap to rebind them. Textareas and every component with a
search or filter field take the same set.
use iced_cube::input;
use iced_cube::primitives::input::{Shortcut, Shortcuts};
#[derive(Debug, Clone)]
enum Message { Name(String) }
// The app has its own undo, so the field leaves Ctrl+Z and Ctrl+Y alone.
let view: iced::Element<'_, Message> = input("Name", "Ada")
.shortcuts(Shortcuts::all().without(Shortcut::Undo).without(Shortcut::Redo))
.on_input(Message::Name)
.into();Structs§
- Input
- A text input builder. Convert it into an
Elementto render. - Metrics
- Resolved dimensions for a
Size. - Shortcuts
- The set of
Shortcuts a text field handles. Every shortcut is on by default. A shortcut that is off is ignored by the field, so its keys reach the app instead.
Enums§
- Shortcut
- A shortcut that inputs, textareas and the search fields inside other
components add to iced’s own editing keys. Each can be switched off in a
Shortcutsset. - Size
- Input dimensions.
Functions§
- clear_
id - The id of the clear button of a clearable input, to find or press it in tests. Every clearable input shares it.
- clear_
style - The clear button: bare at rest, on the accent surface under the pointer.
- default_
keymap - The default shortcut keys. Mod is Cmd on macOS and Ctrl elsewhere; words are deleted with Alt on macOS.
- input
- Creates a text input showing
value, withplaceholderwhile empty. - style
- The iced text input style for a status, optionally marked invalid.