pub struct TextField { /* private fields */ }Expand description
A Material presentation for a caller-owned Base text editing entity.
Keep the entity across renders. It owns selection, undo, composition, focus,
and text. Subscribe to super::TextFieldEvent on the entity to observe user
edits. Set disabled and read-only on the entity before rendering.
Implementations§
Source§impl TextField
impl TextField
Sourcepub fn new(
id: impl Into<ElementId>,
label: impl Into<SharedString>,
state: &Entity<InputBaseState<InputMode>>,
) -> TextField
pub fn new( id: impl Into<ElementId>, label: impl Into<SharedString>, state: &Entity<InputBaseState<InputMode>>, ) -> TextField
Renders a single-line editor.
Sourcepub fn multiline(
id: impl Into<ElementId>,
label: impl Into<SharedString>,
state: &Entity<InputBaseState<TextareaMode>>,
) -> TextField
pub fn multiline( id: impl Into<ElementId>, label: impl Into<SharedString>, state: &Entity<InputBaseState<TextareaMode>>, ) -> TextField
Renders a multi-line editor using the row policy configured in its state.
Sourcepub fn secure(
id: impl Into<ElementId>,
label: impl Into<SharedString>,
state: &Entity<InputBaseState<InputMode>>,
) -> TextField
pub fn secure( id: impl Into<ElementId>, label: impl Into<SharedString>, state: &Entity<InputBaseState<InputMode>>, ) -> TextField
Always masks the editor and suppresses its value from accessibility.
Use a dedicated entity initialized with TextFieldState::masked(true)
so the text is protected even before this field is first rendered.
pub fn variant(self, variant: TextFieldVariant) -> TextField
Sourcepub fn font_scale(self, scale: f32) -> TextField
pub fn font_scale(self, scale: f32) -> TextField
Applies the caller’s user text scale to the editor, label, and supporting text.
pub fn supporting_text(self, text: impl Into<SharedString>) -> TextField
Sourcepub fn error(self, message: impl Into<SharedString>) -> TextField
pub fn error(self, message: impl Into<SharedString>) -> TextField
Displays an error message in place of the supporting text.
Sourcepub fn trailing(self, element: impl IntoElement) -> TextField
pub fn trailing(self, element: impl IntoElement) -> TextField
Places an addon at the logical end of the editing region.
Trait Implementations§
Source§impl IntoElement for TextField
impl IntoElement for TextField
Source§type Element = ViewElement<TextField>
type Element = ViewElement<TextField>
Source§fn into_element(self) -> <TextField as IntoElement>::Element
fn into_element(self) -> <TextField as IntoElement>::Element
Element.Source§fn into_any_element(self) -> AnyElement
fn into_any_element(self) -> AnyElement
AnyElement.Source§impl RenderOnce for TextField
impl RenderOnce for TextField
Source§fn render(self, window: &mut Window, cx: &mut App) -> impl IntoElement
fn render(self, window: &mut Window, cx: &mut App) -> impl IntoElement
Render::render() method
which takes a mutable reference.Auto Trait Implementations§
impl !RefUnwindSafe for TextField
impl !Send for TextField
impl !Sync for TextField
impl !UnwindSafe for TextField
impl Forget for TextField
impl Freeze for TextField
impl Move for TextField
impl Unpin for TextField
impl UnsafeUnpin for TextField
Blanket Implementations§
Source§impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
Source§fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
Source§fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
Source§fn with_spring<T>(
self,
id: impl Into<ElementId>,
animation: SpringAnimation<T>,
animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static,
) -> SpringAnimationElement<Self>
fn with_spring<T>( self, id: impl Into<ElementId>, animation: SpringAnimation<T>, animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static, ) -> SpringAnimationElement<Self>
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
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> FluentBuilder for Twhere
T: IntoElement,
impl<T> FluentBuilder for Twhere
T: IntoElement,
Source§fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
Source§fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
Source§fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<E> TestTextExt for Ewhere
E: IntoElement,
impl<E> TestTextExt for Ewhere
E: IntoElement,
Source§fn test_text(self, text: impl Into<SharedString>) -> Self::Element
fn test_text(self, text: impl Into<SharedString>) -> Self::Element
test-support, records text each time the element paints.
Otherwise returns the element it builds.Source§fn test_alt_text(self, text: impl Into<SharedString>) -> Self::Element
fn test_alt_text(self, text: impl Into<SharedString>) -> Self::Element
Self::test_text for an image’s alternative text, which
stands in for what the element draws.