Skip to main content

TextFieldBuilder

Trait TextFieldBuilder 

Source
pub trait TextFieldBuilder: Sized {
    // Required methods
    fn enabled<M>(self, v: impl IntoReactive<bool, M>) -> Self;
    fn placeholder<M>(self, t: impl IntoText<M>) -> Self;
    fn on_submit(self, f: impl Fn() + 'static) -> Self;
    fn secure<M>(self, v: impl IntoReactive<bool, M>) -> Self;
    fn read_only<M>(self, v: impl IntoReactive<bool, M>) -> Self;
    fn input_purpose(self, purpose: InputPurpose) -> Self;
    fn submit_label(self, label: SubmitLabel) -> Self;
    fn max_length(self, characters: u32) -> Self;
}
Expand description

Builder methods of TextField, reachable through a Decorated (docs/api-style.md “Typed builders and erasure”): generic modifiers and typed ones chain in any order.

Required Methods§

Source

fn enabled<M>(self, v: impl IntoReactive<bool, M>) -> Self

Whether the field takes input (default true); a constant or a reactive bool. A disabled field neither edits nor focuses; TextField::read_only keeps it selectable.

Source

fn placeholder<M>(self, t: impl IntoText<M>) -> Self

Source

fn on_submit(self, f: impl Fn() + 'static) -> Self

Fire when the user submits the field (Return / the keyboard’s action key). Field chaining is a focus write inside the handler: focus.set(Some(Field::Next)) (docs/focus.md).

Source

fn secure<M>(self, v: impl IntoReactive<bool, M>) -> Self

Hide the characters as they are typed (default false). Reactive: bind it to a signal for a show-password switch. The text, the placeholder and the focus carry across the change on every backend, including the two whose secure field is a different native class.

Source

fn read_only<M>(self, v: impl IntoReactive<bool, M>) -> Self

Show the text and let it be selected and copied, and take no edits (default false). Reactive. Unlike .disabled(true) the field keeps its ordinary look and still takes focus.

Source

fn input_purpose(self, purpose: InputPurpose) -> Self

What the field collects: the on-screen keyboard, capitalization and correction, and what the system offers to fill in all follow from it.

Source

fn submit_label(self, label: SubmitLabel) -> Self

What the on-screen keyboard’s action key says. The key fires on_submit either way.

Source

fn max_length(self, characters: u32) -> Self

The most characters the field takes. Typing or pasting past it is cut to fit before the bound value sees it.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<DecoratedInner: TextFieldBuilder + Piece> TextFieldBuilder for Decorated<DecoratedInner>

Source§

impl<S: Binding<String>> TextFieldBuilder for TextField<S>

Day API ↩ Guides· daybrite.dev