pub struct TextInputBuilder { /* private fields */ }Expand description
Builder for configuring a text input element via closure.
Implementations§
Source§impl TextInputBuilder
impl TextInputBuilder
Sourcepub fn placeholder(&mut self, text: &str) -> &mut Self
pub fn placeholder(&mut self, text: &str) -> &mut Self
Sets the placeholder text shown when the input is empty.
Sourcepub fn max_length(&mut self, len: usize) -> &mut Self
pub fn max_length(&mut self, len: usize) -> &mut Self
Sets the maximum number of characters allowed.
Sourcepub fn password(&mut self, enabled: bool) -> &mut Self
pub fn password(&mut self, enabled: bool) -> &mut Self
Enables password mode (characters shown as dots).
Sourcepub fn multiline(&mut self, enabled: bool) -> &mut Self
pub fn multiline(&mut self, enabled: bool) -> &mut Self
Enables multiline mode (Enter inserts newline, up/down arrows navigate lines).
Sourcepub fn font(&mut self, asset: &'static FontAsset) -> &mut Self
pub fn font(&mut self, asset: &'static FontAsset) -> &mut Self
Sets the font to use for this text input.
The font is loaded asynchronously during rendering.
Sourcepub fn text_color(&mut self, color: impl Into<Color>) -> &mut Self
pub fn text_color(&mut self, color: impl Into<Color>) -> &mut Self
Sets the text color.
Sourcepub fn placeholder_color(&mut self, color: impl Into<Color>) -> &mut Self
pub fn placeholder_color(&mut self, color: impl Into<Color>) -> &mut Self
Sets the placeholder text color.
Sourcepub fn cursor_color(&mut self, color: impl Into<Color>) -> &mut Self
pub fn cursor_color(&mut self, color: impl Into<Color>) -> &mut Self
Sets the cursor color.
Sourcepub fn selection_color(&mut self, color: impl Into<Color>) -> &mut Self
pub fn selection_color(&mut self, color: impl Into<Color>) -> &mut Self
Sets the selection highlight color.
Sourcepub fn line_height(&mut self, height: u16) -> &mut Self
pub fn line_height(&mut self, height: u16) -> &mut Self
Sets the line height in pixels for multiline inputs.
When set to a value greater than 0, this overrides the natural font height for spacing between lines. Text is vertically centred within each line slot. A value of 0 (default) uses the natural font height.
Sourcepub fn no_styles_movement(&mut self) -> &mut Self
pub fn no_styles_movement(&mut self) -> &mut Self
Enables no-styles movement mode.
When enabled, cursor navigation skips over } exit positions and
empty content markers, so the cursor only stops at visible character
boundaries. Useful for live-highlighted text inputs where the user
should not navigate through invisible style markup.
Sourcepub fn on_changed<F>(&mut self, callback: F) -> &mut Self
pub fn on_changed<F>(&mut self, callback: F) -> &mut Self
Registers a callback fired whenever the text content changes.