pub struct TextInput { /* private fields */ }Expand description
TextInput widget for text entry.
Implementations§
Source§impl TextInput
impl TextInput
Sourcepub fn placeholder(self, text: impl Into<String>) -> Self
pub fn placeholder(self, text: impl Into<String>) -> Self
Set placeholder text.
Sourcepub fn max_length(self, max: usize) -> Self
pub fn max_length(self, max: usize) -> Self
Set maximum length.
Sourcepub const fn text_style(self, style: TextStyle) -> Self
pub const fn text_style(self, style: TextStyle) -> Self
Set text style.
Sourcepub const fn placeholder_color(self, color: Color) -> Self
pub const fn placeholder_color(self, color: Color) -> Self
Set placeholder color.
Sourcepub const fn background_color(self, color: Color) -> Self
pub const fn background_color(self, color: Color) -> Self
Set background color.
Sourcepub const fn border_color(self, color: Color) -> Self
pub const fn border_color(self, color: Color) -> Self
Set border color.
Sourcepub const fn focus_border_color(self, color: Color) -> Self
pub const fn focus_border_color(self, color: Color) -> Self
Set focus border color.
Sourcepub fn with_test_id(self, id: impl Into<String>) -> Self
pub fn with_test_id(self, id: impl Into<String>) -> Self
Set test ID.
Sourcepub fn with_accessible_name(self, name: impl Into<String>) -> Self
pub fn with_accessible_name(self, name: impl Into<String>) -> Self
Set accessible name.
Sourcepub fn get_placeholder(&self) -> &str
pub fn get_placeholder(&self) -> &str
Get placeholder.
Sourcepub const fn cursor_position(&self) -> usize
pub const fn cursor_position(&self) -> usize
Get cursor position.
Sourcepub const fn is_focused(&self) -> bool
pub const fn is_focused(&self) -> bool
Check if focused.
Sourcepub fn display_text(&self) -> String
pub fn display_text(&self) -> String
Get display text (obscured if password mode).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for TextInput
impl<'de> Deserialize<'de> for TextInput
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Widget for TextInput
impl Widget for TextInput
Source§fn measure(&self, constraints: Constraints) -> Size
fn measure(&self, constraints: Constraints) -> Size
Compute intrinsic size constraints. Read more
Source§fn layout(&mut self, bounds: Rect) -> LayoutResult
fn layout(&mut self, bounds: Rect) -> LayoutResult
Position children within allocated bounds. Read more
Source§fn event(&mut self, event: &Event) -> Option<Box<dyn Any + Send>>
fn event(&mut self, event: &Event) -> Option<Box<dyn Any + Send>>
Handle input events. Read more
Source§fn children_mut(&mut self) -> &mut [Box<dyn Widget>]
fn children_mut(&mut self) -> &mut [Box<dyn Widget>]
Get mutable child widgets.
Source§fn is_interactive(&self) -> bool
fn is_interactive(&self) -> bool
Check if this widget is interactive (can receive focus/events).
Source§fn is_focusable(&self) -> bool
fn is_focusable(&self) -> bool
Check if this widget can receive keyboard focus.
Source§fn accessible_name(&self) -> Option<&str>
fn accessible_name(&self) -> Option<&str>
Get the accessible name for screen readers.
Source§fn accessible_role(&self) -> AccessibleRole
fn accessible_role(&self) -> AccessibleRole
Get the accessible role.
Auto Trait Implementations§
impl Freeze for TextInput
impl RefUnwindSafe for TextInput
impl Send for TextInput
impl Sync for TextInput
impl Unpin for TextInput
impl UnwindSafe for TextInput
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