Skip to content

Component TextArea

MeowLynxSea edited this page Jan 24, 2026 · 4 revisions

TextArea

A multi-line text input.

TextArea owns full text editing state (cursor/selection/marked text) and supports keyboard navigation.

Example

use gpui::ElementId;
use yororen_ui::component::{text_area, EnterBehavior, WrapMode};

let view = text_area()
    .key(("settings", "notes"))
    .placeholder("Notes")
    .wrap(WrapMode::Soft)
    .enter_behavior(EnterBehavior::Newline)
    .on_change(|value, _window, _cx| {
        // ...
    });

When to use

  • Multi-line notes/comments
  • Text editors for small documents

API

  • text_area(): constructor
  • id(...) / key(...): stable identity
  • placeholder("...")
  • disabled(bool)
  • wrap(WrapMode):
    • None (default)
    • Soft
  • enter_behavior(EnterBehavior):
    • Newline (default)
    • Submit
    • Disabled
  • on_change(|value, window, cx| ...)
  • Styling: bg/border/focus_border/text_color/height

Notes

  • Requires one-time registration via yororen_ui::component::init(cx).

Defaults

  • Height: 120px
  • Wrap mode: WrapMode::None
  • Enter behavior: EnterBehavior::Newline

Tips

  • Use WrapMode::Soft for note-taking fields.
  • Use EnterBehavior::Submit for chat/command inputs where Enter should submit.

Clone this wiki locally