pub struct TextArea { /* private fields */ }Expand description
A multi-line editable text area bound to a RwSignal<String> — the multi-line sibling of Input.
A base primitive: unstyled (wrap it in a box for a border/background), keyboard-driven, no soft-wrap (only
\n breaks lines, so long lines overflow horizontally). It requests focus on tap, positions the caret at
the click, edits the bound signal from key events (typing, Enter for a newline, Backspace/Delete joining
lines, arrows in all four directions, Home/End, Tab), and draws a caret. Its measured height grows with the
line count, so wrapping it in a LayoutScrollArea gives a scrolling editor.
Selection (Shift+arrows, Ctrl+A, shift-click) with copy, cut and paste, newlines and all. IME is not
yet supported.
Implementations§
Source§impl TextArea
impl TextArea
pub fn new( value: RwSignal<String>, layout_style: LayoutStyle, style_fn: impl Fn() -> TextStyle + 'static, ) -> Result<TextArea, LayoutError>
Sourcepub fn placeholder(self, p: impl Into<String>) -> TextArea
pub fn placeholder(self, p: impl Into<String>) -> TextArea
A muted hint shown while the value is empty.
Sourcepub fn request_focus(&self)
pub fn request_focus(&self)
Gives keyboard focus to this area (as a tap would), leaving the caret where it was. For programmatic focus — e.g. a container autofocusing the editor when its tab or window becomes active.
Sourcepub fn focus_handle(&self) -> FocusHandle
pub fn focus_handle(&self) -> FocusHandle
A Copy focus::FocusHandle to this area, so a caller that has moved it into a container can still
focus it later (e.g. autofocus on tab activation) without keeping a reference to the area itself.
Trait Implementations§
Source§impl Component for TextArea
impl Component for TextArea
fn view(&self) -> RenderNode
fn on_event(&mut self, event: &Event) -> EventResult
Source§fn debug_name(&self) -> &'static str
fn debug_name(&self) -> &'static str
Auto Trait Implementations§
impl !RefUnwindSafe for TextArea
impl !Send for TextArea
impl !Sync for TextArea
impl !UnwindSafe for TextArea
impl Freeze for TextArea
impl Unpin for TextArea
impl UnsafeUnpin for TextArea
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more