pub struct Input { /* private fields */ }Expand description
Input component - single-line text input.
Implementations§
Source§impl Input
impl Input
Sourcepub fn with_prompt(prompt: &str) -> Self
pub fn with_prompt(prompt: &str) -> Self
Create an input with a custom prompt.
Sourcepub fn with_placeholder(placeholder: &str) -> Self
pub fn with_placeholder(placeholder: &str) -> Self
Create an input with a placeholder.
Sourcepub fn on_submit(&self, callback: Arc<dyn Fn(&str) + Send + Sync>)
pub fn on_submit(&self, callback: Arc<dyn Fn(&str) + Send + Sync>)
Set callback for when input is submitted (Enter pressed).
Sourcepub fn on_escape(&self, callback: Arc<dyn Fn() + Send + Sync>)
pub fn on_escape(&self, callback: Arc<dyn Fn() + Send + Sync>)
Set callback for when escape is pressed.
Sourcepub fn on_change(&self, callback: Arc<dyn Fn(&str) + Send + Sync>)
pub fn on_change(&self, callback: Arc<dyn Fn(&str) + Send + Sync>)
Set callback for when value changes.
Sourcepub fn handle_paste(&self, pasted_text: &str)
pub fn handle_paste(&self, pasted_text: &str)
Handle bracketed paste.
Sourcepub fn handle_key(&self, key: KeyEvent)
pub fn handle_key(&self, key: KeyEvent)
Handle key input.
Trait Implementations§
Source§impl Component for Input
impl Component for Input
Source§fn render(&self, width: usize) -> Vec<String>
fn render(&self, width: usize) -> Vec<String>
Render the component to lines for the given viewport width. Read more
Source§fn invalidate(&self)
fn invalidate(&self)
Invalidate any cached rendering state.
Called when theme changes or when component needs to re-render from scratch.
Source§fn as_any(&self) -> &dyn Any
fn as_any(&self) -> &dyn Any
Downcast to Any for runtime type checking.
This enables the layout system to check for LayoutNodeProvider.
Source§fn handle_input(&self, _data: &str) -> bool
fn handle_input(&self, _data: &str) -> bool
Optional handler for keyboard input when component has focus. Read more
Source§fn wants_key_release(&self) -> bool
fn wants_key_release(&self) -> bool
If true, component receives key release events (Kitty protocol).
Default is false - release events are filtered out.
Auto Trait Implementations§
impl !Freeze for Input
impl RefUnwindSafe for Input
impl Send for Input
impl Sync for Input
impl Unpin for Input
impl UnsafeUnpin for Input
impl UnwindSafe for Input
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