Skip to main content

Module textarea

Module textarea 

Source
Expand description

A multi-line editable text control.

TextArea is a view rather than a RenderOnce builder, for the same reason crate::controls::input::TextInput is: the caret, the selection, the in-progress input method composition, and the vertical scroll position all outlive a frame. Text wraps at the width the control was given, so there is no horizontal scrolling, and the caret moves by visual line.

let notes = cx.new(|cx| {
    TextArea::new("review.notes", window, cx)
        .placeholder("What changed, and why")
        .rows(4)
        .max_rows(12)
});
cx.subscribe(&notes, |_host, notes, event, cx| {
    if let TextAreaEvent::Submit = event {
        let _typed = notes.read(cx).value().to_string();
    }
})
.detach();

Structs§

Backspace
Cancel
Copy
Cut
Delete
DeleteToLineStart
DeleteWordLeft
DeleteWordRight
DocumentEnd
DocumentStart
Down
Left
LineEnd
LineStart
Newline
Paste
Right
SelectAll
SelectDown
SelectLeft
SelectRight
SelectToDocumentEnd
SelectToDocumentStart
SelectToLineEnd
SelectToLineStart
SelectUp
SelectWordLeft
SelectWordRight
ShowCharacterPalette
Submit
TextArea
Wrapped, multi-line editable text.
Up
WordLeft
WordRight

Enums§

TextAreaEvent
What a text area reports to its owner.

Constants§

KEY_CONTEXT
The key context every text area publishes, so a host can layer its own bindings on top without re-declaring these.