Skip to content

Component TextArea

MeowLynxSea edited this page Jun 18, 2026 · 4 revisions

TextArea

A multi-line text input. Paste keeps newlines (unlike TextInput, which strips them).

use yororen_ui::headless::text_area::text_area;

text_area("bio")
    .placeholder("Tell us about yourself…")
    .max_length(2048)
    .on_change({
        let entity = cx.entity();
        move |new: &str, _, cx| entity.update(cx, |s, _| s.bio = new.to_string());
    })
    .render(cx, window)

Props

Method Purpose
placeholder(text) Hint shown when empty.
max_length(n) Hard cap on UTF-8 byte length.
disabled(v) Disable interaction.
on_change(closure) Fn(&str, &mut Window, &mut App) + 'static + Send + Sync.
has_custom_bg(v) / custom_bg(hsla) Override background.
has_custom_border(v) / custom_border(hsla) Override border.
has_custom_focus_border(v) / custom_focus_border(hsla) Override focus border.
custom_text_color(hsla) Override text color.

Factory takes (id) only. .render(cx, window) returns AnyElement. on_change receives &str — convert with .to_string(). The boot step from TextInput covers this component too.

See also: TextInput, SearchInput, Form.

Clone this wiki locally