pub struct Text { /* private fields */ }Expand description
A multi-line text area field.
The Text field is used for gathering longer-form user input. It wraps the bubbles textarea component and integrates it with the huh form system.
§Example
ⓘ
use huh::Text;
let text = Text::new()
.key("bio")
.title("Biography")
.description("Tell us about yourself")
.placeholder("Enter your bio...")
.lines(5);Implementations§
Source§impl Text
impl Text
Sourcepub fn description(self, description: impl Into<String>) -> Self
pub fn description(self, description: impl Into<String>) -> Self
Sets the description.
Sourcepub fn placeholder(self, placeholder: impl Into<String>) -> Self
pub fn placeholder(self, placeholder: impl Into<String>) -> Self
Sets the placeholder text.
Sourcepub fn char_limit(self, limit: usize) -> Self
pub fn char_limit(self, limit: usize) -> Self
Sets the character limit (0 = no limit).
Sourcepub fn show_line_numbers(self, show: bool) -> Self
pub fn show_line_numbers(self, show: bool) -> Self
Sets whether to show line numbers.
Sourcepub fn validate(self, validate: fn(&str) -> Option<String>) -> Self
pub fn validate(self, validate: fn(&str) -> Option<String>) -> Self
Sets the validation function.
Sourcepub fn get_string_value(&self) -> &str
pub fn get_string_value(&self) -> &str
Gets the current value.
Trait Implementations§
Source§impl Field for Text
impl Field for Text
Source§fn with_theme(&mut self, theme: &Theme)
fn with_theme(&mut self, theme: &Theme)
Sets the theme.
Source§fn with_keymap(&mut self, keymap: &KeyMap)
fn with_keymap(&mut self, keymap: &KeyMap)
Sets the keymap.
Source§fn with_width(&mut self, width: usize)
fn with_width(&mut self, width: usize)
Sets the width.
Source§fn with_height(&mut self, height: usize)
fn with_height(&mut self, height: usize)
Sets the height.
Source§fn with_position(&mut self, position: FieldPosition)
fn with_position(&mut self, position: FieldPosition)
Sets the field position.
Auto Trait Implementations§
impl Freeze for Text
impl !RefUnwindSafe for Text
impl Send for Text
impl Sync for Text
impl Unpin for Text
impl !UnwindSafe for Text
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