pub enum TextFieldLineLimits {
SingleLine,
MultiLine {
min_lines: usize,
max_lines: usize,
},
}Expand description
Line limit configuration for text fields.
Controls whether a text field allows multiple lines of input and how many lines are visible at minimum and maximum.
§SingleLine
When SingleLine is used:
- Newline characters (
\n) are blocked from input - Pasted text has newlines replaced with spaces
- The text field scrolls horizontally if content exceeds width
- The Enter key does NOT insert a newline (may trigger submit action)
§MultiLine
When MultiLine is used:
- Newline characters are allowed
- The text field scrolls vertically if content exceeds visible lines
min_linescontrols minimum visible height (default: 1)max_linescontrols maximum visible height before scrolling (default: unlimited)
§Example
use cranpose_foundation::text::TextFieldLineLimits;
// Single-line text field (like a search box)
let single = TextFieldLineLimits::SingleLine;
// Multi-line with default settings
let multi = TextFieldLineLimits::default();
// Multi-line with 3-5 visible lines
let constrained = TextFieldLineLimits::MultiLine { min_lines: 3, max_lines: 5 };Variants§
SingleLine
Single line input - no newlines allowed, horizontal scrolling.
MultiLine
Multi-line input with optional line constraints.
min_lines: Minimum number of visible lines (affects minimum height)max_lines: Maximum number of visible lines before scrolling
Implementations§
Source§impl TextFieldLineLimits
impl TextFieldLineLimits
Sourcepub const DEFAULT: Self
pub const DEFAULT: Self
Default multi-line with no constraints (1 line minimum, unlimited maximum).
Sourcepub fn is_single_line(&self) -> bool
pub fn is_single_line(&self) -> bool
Returns true if this is single-line mode.
Sourcepub fn is_multi_line(&self) -> bool
pub fn is_multi_line(&self) -> bool
Returns true if this is multi-line mode.
Trait Implementations§
Source§impl Clone for TextFieldLineLimits
impl Clone for TextFieldLineLimits
Source§fn clone(&self) -> TextFieldLineLimits
fn clone(&self) -> TextFieldLineLimits
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TextFieldLineLimits
impl Debug for TextFieldLineLimits
Source§impl Default for TextFieldLineLimits
impl Default for TextFieldLineLimits
Source§impl PartialEq for TextFieldLineLimits
impl PartialEq for TextFieldLineLimits
impl Copy for TextFieldLineLimits
impl Eq for TextFieldLineLimits
impl StructuralPartialEq for TextFieldLineLimits
Auto Trait Implementations§
impl Freeze for TextFieldLineLimits
impl RefUnwindSafe for TextFieldLineLimits
impl Send for TextFieldLineLimits
impl Sync for TextFieldLineLimits
impl Unpin for TextFieldLineLimits
impl UnwindSafe for TextFieldLineLimits
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