Skip to main content

TextField

Struct TextField 

Source
pub struct TextField { /* private fields */ }

Implementations§

Source§

impl TextField

Source

pub fn new(value: Signal<String>) -> Self

Source

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

Source

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

Source

pub fn secure(self, secure: bool) -> Self

Masks the value with bullets. Copy and cut are disabled so the secret does not leak through the clipboard, and accessibility exposes the masked text only.

Source

pub fn password(self, password: bool) -> Self

Source

pub fn readonly(self, readonly: bool) -> Self

Keeps the field focusable and selectable while blocking edits.

Source

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

Source

pub fn error(self, error: bool) -> Self

Draws the error border. The message itself belongs to the form field.

Source

pub fn auto_size(self, auto: bool) -> Self

Sizes the field to its content height instead of the fixed default.

Source

pub fn on_edit_start(self, f: impl Fn() + 'static) -> Self

Source

pub fn on_edit_end(self, f: impl Fn(String) + 'static) -> Self

Source

pub fn on_submit(self, f: impl Fn(String) + 'static) -> Self

Source

pub fn font_size(self, size: f32) -> Self

Source

pub fn weight(self, weight: FontWeight) -> Self

Source

pub fn bold(self, bold: bool) -> Self

Source

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

Source

pub fn line_color(self, color: Color) -> Self

Source

pub fn appearance(self, style: TextFieldStyle) -> Self

Source

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

Source

pub fn line_width(self, width: f32) -> Self

Source

pub fn background(self, color: Color) -> Self

Source

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

Source

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

Source

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

Source

pub fn radius(self, radius: f32) -> Self

Source

pub fn padding(self, padding: impl Into<Edges>) -> Self

Source

pub fn padding_xy(self, x: f32, y: f32) -> Self

Source

pub fn width(self, width: impl Into<Length>) -> Self

Source

pub fn height(self, height: impl Into<Length>) -> Self

Source

pub fn min_width(self, v: f32) -> Self

Source

pub fn max_width(self, v: f32) -> Self

Source

pub fn min_height(self, v: f32) -> Self

Source

pub fn max_height(self, v: f32) -> Self

Source

pub fn flex(self, weight: f32) -> Self

Source

pub fn expand(self) -> Self

Source

pub fn margin(self, margin: impl Into<Edges>) -> Self

Source

pub fn margin_xy(self, x: f32, y: f32) -> Self

Source

pub fn margin_x(self, x: f32) -> Self

Source

pub fn margin_y(self, y: f32) -> Self

Source

pub fn margin_left(self, v: f32) -> Self

Source

pub fn margin_right(self, v: f32) -> Self

Source

pub fn margin_top(self, v: f32) -> Self

Source

pub fn margin_bottom(self, v: f32) -> Self

Source

pub fn caret(&self) -> usize

Source

pub fn selection(&self) -> Option<(usize, usize)>

Source

pub fn selected_text(&self) -> Option<String>

Source

pub fn select_range(&self, a: usize, b: usize)

Source

pub fn clear_selection(&self) -> bool

Source

pub fn select_all(&self)

Source

pub fn submit(&self)

Trait Implementations§

Source§

impl View for TextField

Source§

fn body(&self) -> impl View + 'static

Source§

fn accessibility(&self) -> Option<Accessible>

Source§

fn accepts_text_input(&self) -> bool

Whether this view edits text when focused. Read more
Source§

fn ime_caret_rect(&self) -> Option<Rect>

Caret rectangle in window coordinates, used to place the platform IME candidate window. Widgets with a text caret return the box the caret occupies; hosts fall back to the focused element’s bounds when this is None.
Source§

fn reuse_state(&self, old: &Self)

Source§

fn layout_style_ctx(&self, _rt: &Runtime, _el: ElementId) -> LayoutStyle

Source§

fn arrange_override( &self, _rt: &Runtime, _el: ElementId, _rect: Rect, _ctx: &mut LayoutCtx<'_>, ) -> bool

Source§

fn clip_self(&self) -> bool

Source§

fn clip_radius(&self) -> f32

Source§

fn paint_opacity(&self) -> Option<f32>

Source§

fn cache_layer(&self) -> bool

Allows the runtime to replay this element’s painted subtree from cache while its element revision and absolute paint context stay unchanged. Read more
Source§

fn paint_opacity_ctx(&self, _rt: &Runtime, _el: ElementId) -> Option<f32>

Source§

fn paint_offset(&self) -> Vec2

Source§

fn paint_offset_ctx(&self, _rt: &Runtime, _el: ElementId) -> Vec2

Source§

fn paint_scale(&self) -> f32

Source§

fn paint_scale_ctx(&self, _rt: &Runtime, _el: ElementId) -> f32

Source§

fn paint_rotation(&self) -> f32

Source§

fn paint_rotation_ctx(&self, _rt: &Runtime, _el: ElementId) -> f32

Source§

fn foreground_filter(&self) -> Option<Filter>

Source§

fn captures_pointer_ctx(&self, _rt: &Runtime, _el: ElementId) -> bool

Source§

fn hit_testable(&self) -> bool

Source§

fn test_id(&self) -> Option<String>

Source§

fn focus_trap(&self) -> bool

Source§

fn accepts_tab(&self) -> bool

Source§

fn paint_foreground(&self, _ctx: &mut PaintCtx<'_>)

Source§

fn accepts_drop(&self, _payload: &DragPayload) -> bool

Source§

fn on_drag_over(&self, _pos: DropPosition, _ctx: &mut EventCtx<'_>)

Source§

fn on_drop(&self, _pos: DropPosition, _ctx: &mut EventCtx<'_>)

Source§

fn on_drag_start(&self, _ctx: &mut EventCtx<'_>)

Source§

fn on_drag_end(&self, _end: DragEnd, _ctx: &mut EventCtx<'_>)

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> FilterExt for T
where T: View + 'static,

Source§

fn blur_own(self, radius: f32) -> Filtered

Source§

fn blur_own_with(self, build: impl FnOnce(Filter) -> Filter) -> Filtered

Source§

fn blur_behind(self, radius: f32) -> BackdropFiltered

Source§

fn blur_behind_with( self, build: impl FnOnce(Backdrop) -> Backdrop, ) -> BackdropFiltered

Source§

fn effect(self, effect: Effect) -> EffectNode

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> LiveExt for T
where T: View + 'static,

Source§

fn opacity_live(self, live: impl Into<Live<f32>>) -> LiveOpacity

Source§

fn offset_live(self, live: impl Into<Live<Vec2>>) -> LiveOffset

Source§

fn background_live(self, live: impl Into<Live<Color>>) -> LiveBackground

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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> ViewModifiers for T
where T: View + 'static,

Source§

fn opacity(self, opacity: impl Into<Live<f32>>) -> LiveOpacity

Source§

fn offset(self, dx: f32, dy: f32) -> LiveOffset

Source§

fn offset_by(self, offset: impl Into<Live<Vec2>>) -> LiveOffset

Source§

fn background(self, color: impl Into<Live<Color>>) -> LiveBackground

Source§

fn bg(self, color: impl Into<Live<Color>>) -> LiveBackground

Source§

fn blur(self, px: f32) -> Filtered

Source§

fn shadow(self, spec: ShadowSpec) -> EffectNode

Wraps the view in an EffectNode that paints spec behind it. Read more
Source§

fn clip(self) -> Clip

Source§

fn clip_rounded(self, radius: f32) -> Clip

Source§

fn scale(self, scale: impl Into<Live<f32>>) -> Scaled

Source§

fn rotate(self, degrees: impl Into<Live<f32>>) -> Rotated

Source§

fn width_live(self, width: impl Into<Live<f32>>) -> AnimatedSize

Source§

fn height_live(self, height: impl Into<Live<f32>>) -> AnimatedSize

Source§

fn size_live( self, width: impl Into<Live<f32>>, height: impl Into<Live<f32>>, ) -> AnimatedSize

Source§

fn animate(self, spec: impl Into<AnimSpec>) -> Enter

Source§

fn enter(self, motion: impl Into<Motion>) -> Enter

Source§

fn hover(self, build: impl FnOnce(StatePatch) -> StatePatch) -> States

Source§

fn pressed(self, build: impl FnOnce(StatePatch) -> StatePatch) -> States

Source§

fn focused(self, build: impl FnOnce(StatePatch) -> StatePatch) -> States

Source§

fn selected(self, build: impl FnOnce(StatePatch) -> StatePatch) -> States

Source§

fn disabled(self, build: impl FnOnce(StatePatch) -> StatePatch) -> States

Source§

fn state(self, build: impl FnOnce(States) -> States) -> States

Source§

fn margin(self, margin: impl Into<Edges>) -> Margined

Source§

fn margin_xy(self, x: f32, y: f32) -> Margined

Source§

fn margin_x(self, x: f32) -> Margined

Source§

fn margin_y(self, y: f32) -> Margined

Source§

fn margin_left(self, v: f32) -> Margined

Source§

fn margin_right(self, v: f32) -> Margined

Source§

fn margin_top(self, v: f32) -> Margined

Source§

fn margin_bottom(self, v: f32) -> Margined

Source§

fn indent_top(self, v: f32) -> Margined

Source§

fn indent_bottom(self, v: f32) -> Margined

Source§

fn indent_left(self, v: f32) -> Margined

Source§

fn indent_right(self, v: f32) -> Margined

Source§

fn indent(self, indents: Indents) -> Margined

Source§

fn indent_all(self, v: f32) -> Margined

Source§

fn indent_xy(self, x: f32, y: f32) -> Margined

Source§

fn indent_axes(self, horizontal: f32, vertical: f32) -> Margined