Skip to main content

TextInput

Struct TextInput 

Source
pub struct TextInput { /* private fields */ }
Expand description

TextInput widget using FSM-driven Stateful for incremental updates

Implementations§

Source§

impl TextInput

Source

pub fn new(data: Arc<Mutex<TextInputData>>) -> TextInput

Create a text input with externally-managed data state

Source

pub fn w(self, px: f32) -> TextInput

Source

pub fn w_full(self) -> TextInput

Source

pub fn min_w(self, px: f32) -> TextInput

Source

pub fn h(self, px: f32) -> TextInput

Source

pub fn placeholder(self, text: impl Into<String>) -> TextInput

Source

pub fn input_type(self, input_type: InputType) -> TextInput

Source

pub fn disabled(self, disabled: bool) -> TextInput

Source

pub fn masked(self, masked: bool) -> TextInput

Source

pub fn max_length(self, max: usize) -> TextInput

Source

pub fn text_size(self, size: f32) -> TextInput

Set the font size for the text input (default: 16.0)

Source

pub fn rounded(self, radius: f32) -> TextInput

Source

pub fn border(self, width: f32, color: Color) -> TextInput

Source

pub fn border_color(self, color: Color) -> TextInput

Source

pub fn border_width(self, width: f32) -> TextInput

Source

pub fn shadow_sm(self) -> TextInput

Source

pub fn shadow_md(self) -> TextInput

Source

pub fn flex_grow(self) -> TextInput

Source

pub fn id(self, id: &str) -> TextInput

Set the CSS element ID for stylesheet matching

When set, the TextInput will query the active stylesheet for styles matching #id, #id:hover, #id:focus, #id:disabled, and #id::placeholder.

Source

pub fn class(self, name: &str) -> TextInput

Add a CSS class name for selector matching

Source

pub fn idle_border_color(self, color: Color) -> TextInput

Set the idle border color (when not hovered or focused)

Source

pub fn hover_border_color(self, color: Color) -> TextInput

Set the hover border color

Source

pub fn focused_border_color(self, color: Color) -> TextInput

Set the focused border color

Source

pub fn error_border_color(self, color: Color) -> TextInput

Set the error border color (shown when is_valid is false)

Source

pub fn border_colors( self, idle: Color, hover: Color, focused: Color, error: Color, ) -> TextInput

Set all border colors at once for consistent theming

Source

pub fn idle_bg_color(self, color: Color) -> TextInput

Set the idle background color

Source

pub fn hover_bg_color(self, color: Color) -> TextInput

Set the hover background color

Source

pub fn focused_bg_color(self, color: Color) -> TextInput

Set the focused background color

Source

pub fn bg_colors(self, idle: Color, hover: Color, focused: Color) -> TextInput

Set all background colors at once

Source

pub fn text_color(self, color: Color) -> TextInput

Set the text color

Source

pub fn placeholder_color(self, color: Color) -> TextInput

Set the placeholder text color

Source

pub fn cursor_color(self, color: Color) -> TextInput

Set the cursor color

Source

pub fn selection_color(self, color: Color) -> TextInput

Set the selection highlight color

Source

pub fn on_change<F>(self, callback: F) -> TextInput
where F: Fn(&str) + Send + Sync + 'static,

Set the callback to be invoked when the text value changes

The callback receives the new text value as a string slice. This is called after insert or delete operations modify the text.

§Example
text_input(&data)
    .on_change(|new_value| {
        println!("Text changed to: {}", new_value);
    })

Trait Implementations§

Source§

impl ElementBuilder for TextInput

Source§

fn build(&self, tree: &mut LayoutTree) -> LayoutNodeId

Build this element into a layout tree, returning the node ID
Source§

fn render_props(&self) -> RenderProps

Get the render properties for this element
Source§

fn children_builders(&self) -> &[Box<dyn ElementBuilder>]

Get children builders (for recursive traversal)
Source§

fn element_type_id(&self) -> ElementTypeId

Get the element type identifier
Source§

fn semantic_type_name(&self) -> Option<&'static str>

Semantic HTML-like tag name for CSS type selectors (e.g., “button”, “a”, “ul”) Read more
Source§

fn event_handlers(&self) -> Option<&EventHandlers>

Get event handlers for this element Read more
Source§

fn layout_style(&self) -> Option<&Style>

Get the layout style for this element Read more
Source§

fn layout_bounds_storage(&self) -> Option<Arc<Mutex<Option<ElementBounds>>>>

Get layout bounds storage for this element Read more
Source§

fn layout_bounds_callback( &self, ) -> Option<Arc<dyn Fn(ElementBounds) + Send + Sync>>

Get layout bounds change callback for this element Read more
Source§

fn text_render_info(&self) -> Option<TextRenderInfo>

Get text render info if this is a text element
Source§

fn styled_text_render_info(&self) -> Option<StyledTextRenderInfo>

Get styled text render info if this is a styled text element (rich_text)
Source§

fn svg_render_info(&self) -> Option<SvgRenderInfo>

Get SVG render info if this is an SVG element
Source§

fn image_render_info(&self) -> Option<ImageRenderInfo>

Get image render info if this is an image element
Source§

fn canvas_render_info( &self, ) -> Option<Rc<dyn Fn(&mut dyn DrawContext, CanvasBounds)>>

Get canvas render info if this is a canvas element
Source§

fn scroll_info(&self) -> Option<ScrollRenderInfo>

Get scroll render info if this is a scroll element
Source§

fn scroll_physics(&self) -> Option<Arc<Mutex<ScrollPhysics>>>

Get scroll physics handle if this is a scroll element
Source§

fn motion_animation_for_child( &self, _child_index: usize, ) -> Option<MotionAnimation>

Get motion animation config for a child at given index Read more
Source§

fn motion_bindings(&self) -> Option<MotionBindings>

Get motion bindings for continuous animation Read more
Source§

fn motion_stable_id(&self) -> Option<&str>

Get stable ID for motion animation tracking Read more
Source§

fn motion_should_replay(&self) -> bool

Check if this motion should replay its animation Read more
Source§

fn motion_is_suspended(&self) -> bool

Check if this motion should start in suspended state Read more
Source§

fn motion_is_exiting(&self) -> bool

👎Deprecated since 0.1.0:

Use query_motion(key).exit() to explicitly trigger motion exit

DEPRECATED: Check if this motion should start its exit animation Read more
Source§

fn element_id(&self) -> Option<&str>

Get the element ID for selector API queries Read more
Source§

fn set_auto_id(&mut self, _id: String) -> bool

Set an auto-generated element ID (used by stateful containers for stable child IDs). Read more
Source§

fn children_builders_mut(&mut self) -> &mut [Box<dyn ElementBuilder>]

Get mutable access to children for auto-ID assignment
Source§

fn element_classes(&self) -> &[String]

Get the element’s CSS class list for selector matching
Source§

fn bound_scroll_ref(&self) -> Option<&ScrollRef>

Get the bound ScrollRef for programmatic scroll control Read more
Source§

fn motion_on_ready_callback( &self, ) -> Option<Arc<dyn Fn(ElementBounds) + Send + Sync>>

Get the on_ready callback for this motion container Read more
Source§

fn layout_animation_config(&self) -> Option<LayoutAnimationConfig>

Get layout animation configuration for this element Read more
Source§

fn visual_animation_config(&self) -> Option<VisualAnimationConfig>

Get visual animation config for new FLIP-style animations (read-only layout) Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more