A text field holding value.
One line of text (.rows(n) makes it an area of n lines). .on_input(f) sends the whole new text on every edit, .on_submit(message) the Enter key; .placeholder(..) shows while it is empty. The app keeps the text and gives it back, so it can refuse or change what was typed.
Signature
pub const fn text_field<M>(value: &str) -> TextField<'_, M>Methods
.placeholder(text: &'static str) -> Self— Shown, muted, while it is empty..rows(rows: u8) -> Self— Makes it a text area ofrowslines (at least 2): Enter breaks the line instead of submitting, Up and Down move between lines..on_submit(message: M) -> Self— Sendsmessagewhen Enter is pressed in the field..on_input(f: fn(&str) -> M) -> Self— Sends a message made from the new text whenever it changes.
Example
use fusuma::{column, text_field};
let name = "Ada";
let view = column((text_field(name).placeholder("Your name").on_input(|_| ()),));
let built = fusuma::doc::built::<(), _>(&view);
assert_eq!(built.nodes(), 2);