Skip to main content

TextAreaBuilder

Trait TextAreaBuilder 

Source
pub trait TextAreaBuilder: Sized {
    // Required methods
    fn placeholder<M>(self, t: impl IntoText<M>) -> Self;
    fn min_lines(self, lines: u32) -> Self;
    fn max_lines(self, lines: u32) -> Self;
    fn editable<M>(self, v: impl IntoReactive<bool, M>) -> Self;
    fn selectable<M>(self, v: impl IntoReactive<bool, M>) -> Self;
    fn spellcheck<M>(self, v: impl IntoReactive<bool, M>) -> Self;
    fn on_submit(self, f: impl Fn() + 'static) -> Self;
}
Expand description

Builder methods of TextArea, 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 placeholder<M>(self, t: impl IntoText<M>) -> Self

The empty-state prompt shown when the editor is empty (a constant, Signal<String>, or closure, evaluated once for the initial value; not reactive after build).

Source

fn min_lines(self, lines: u32) -> Self

The minimum height, in text lines (default 1): the editor never shrinks below this.

Source

fn max_lines(self, lines: u32) -> Self

The maximum height, in text lines, before the editor scrolls internally. 0 (the default) means unbounded: the editor keeps growing and never scrolls.

Source

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

Whether the user can edit the text (default true; false = read-only). Reactive.

Source

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

Whether the text can be selected and copied (default true). Reactive. Unsupported on backends where selection is always on (GTK).

Source

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

Whether spell-check / autocorrect highlighting is on (default true). Reactive. Unsupported on backends with no built-in spell-check (GTK, Qt).

Source

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

Submit on Enter: a plain Enter runs f instead of inserting a newline, the chat-composer contract. Shift+Enter still inserts a line break on desktop and ArkUI; Android and ArkUI show a Send action on the soft keyboard; iOS’s return key submits. Backends without the intercept (web-dom today) keep inserting newlines, so pair this with a visible send button. The bound text signal is already up to date when f runs.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

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

Source§

impl<S: Binding<String>> TextAreaBuilder for TextArea<S>

Day API ↩ Guides· daybrite.dev