pub struct TextArea<'a> { /* private fields */ }Expand description
A styled multi-line text input.
let mut notes = String::new();
ui.add(
TextArea::new(&mut notes)
.label("Notes")
.hint("Jot anything down…")
.rows(6),
);§Ids, focus, and flash state
As with TextInput, pin a stable
id_salt on any TextArea you plan to flash — otherwise
the id is layout-dependent and in-flight flash/focus/cursor state is
lost if siblings above this widget appear or disappear between frames.
Implementations§
Source§impl<'a> TextArea<'a>
impl<'a> TextArea<'a>
Sourcepub fn label(self, text: impl Into<WidgetText>) -> Self
pub fn label(self, text: impl Into<WidgetText>) -> Self
Show a label above the text area.
Sourcepub fn hint(self, text: &'a str) -> Self
pub fn hint(self, text: &'a str) -> Self
Show placeholder-style hint text when the field is empty.
Sourcepub fn dirty(self, dirty: bool) -> Self
pub fn dirty(self, dirty: bool) -> Self
Mark the input as having unsaved changes. Shows a sky-coloured accent bar down the left side.
Sourcepub fn desired_width(self, width: f32) -> Self
pub fn desired_width(self, width: f32) -> Self
Desired width (points) for the editor portion of the widget.
Sourcepub fn monospace(self, monospace: bool) -> Self
pub fn monospace(self, monospace: bool) -> Self
Render the text in the theme’s monospace font. Useful for code, JSON blobs, PEM keys, and similar fixed-width content.
Sourcepub fn id_salt(self, id: impl Hash) -> Self
pub fn id_salt(self, id: impl Hash) -> Self
Supply a stable id salt. Required if you plan to flash this widget
via ResponseFlashExt.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for TextArea<'a>
impl<'a> RefUnwindSafe for TextArea<'a>
impl<'a> Send for TextArea<'a>
impl<'a> Sync for TextArea<'a>
impl<'a> Unpin for TextArea<'a>
impl<'a> UnsafeUnpin for TextArea<'a>
impl<'a> !UnwindSafe for TextArea<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more