TextEditorArgs

Struct TextEditorArgs 

Source
pub struct TextEditorArgs {
Show 15 fields pub width: DimensionValue, pub height: DimensionValue, pub on_change: Arc<dyn Fn(String) -> String + Send + Sync>, pub min_width: Option<Dp>, pub min_height: Option<Dp>, pub background_color: Option<Color>, pub border_width: Dp, pub border_color: Option<Color>, pub shape: Shape, pub padding: Dp, pub focus_border_color: Option<Color>, pub focus_background_color: Option<Color>, pub selection_color: Option<Color>, pub accessibility_label: Option<String>, pub accessibility_description: Option<String>,
}
Expand description

Arguments for configuring the text_editor component.

Fields§

§width: DimensionValue

Width constraint for the text editor. Defaults to Wrap.

§height: DimensionValue

Height constraint for the text editor. Defaults to Wrap.

§on_change: Arc<dyn Fn(String) -> String + Send + Sync>

Called when the text content changes. The closure receives the new text content and returns the updated content.

§min_width: Option<Dp>

Minimum width in density-independent pixels. Defaults to 120dp if not specified.

§min_height: Option<Dp>

Minimum height in density-independent pixels. Defaults to line height + padding if not specified.

§background_color: Option<Color>

Background color of the text editor (RGBA). Defaults to light gray.

§border_width: Dp

Border width in Dp. Defaults to 1.0 Dp.

§border_color: Option<Color>

Border color (RGBA). Defaults to gray.

§shape: Shape

The shape of the text editor container.

§padding: Dp

Padding inside the text editor. Defaults to 5.0 Dp.

§focus_border_color: Option<Color>

Border color when focused (RGBA). Defaults to blue.

§focus_background_color: Option<Color>

Background color when focused (RGBA). Defaults to white.

§selection_color: Option<Color>

Color for text selection highlight (RGBA). Defaults to light blue with transparency.

§accessibility_label: Option<String>

Optional label announced by assistive technologies.

§accessibility_description: Option<String>

Optional description announced by assistive technologies.

Implementations§

Source§

impl TextEditorArgs

Convenience constructors for common use cases

Source

pub fn simple() -> Self

Creates a simple text editor with default styling.

  • Minimum width: 120dp
  • Background: white
  • Border: 1px gray, rounded rectangle
§Example
use tessera_ui_basic_components::text_editor::TextEditorArgs;
let args = TextEditorArgs::simple();
Source

pub fn outlined() -> Self

Creates a text editor with an emphasized border for better visibility.

  • Border: 2px, blue focus border
§Example
use tessera_ui_basic_components::text_editor::TextEditorArgs;
let args = TextEditorArgs::outlined();
Source

pub fn minimal() -> Self

Creates a text editor with no border (minimal style).

  • Border: 0px, square corners
§Example
use tessera_ui_basic_components::text_editor::TextEditorArgs;
let args = TextEditorArgs::minimal();
Source§

impl TextEditorArgs

Builder methods for fluent API

Source

pub fn with_width(self, width: DimensionValue) -> Self

Sets the width constraint for the editor.

§Example
use tessera_ui_basic_components::text_editor::TextEditorArgs;
use tessera_ui::{DimensionValue, Px};
let args = TextEditorArgs::simple().with_width(DimensionValue::Fixed(Px(200)));
Source

pub fn with_height(self, height: DimensionValue) -> Self

Sets the height constraint for the editor.

§Example
use tessera_ui_basic_components::text_editor::TextEditorArgs;
use tessera_ui::{DimensionValue, Px};
let args = TextEditorArgs::simple().with_height(DimensionValue::Fixed(Px(100)));
Source

pub fn with_min_width(self, min_width: Dp) -> Self

Sets the minimum width in Dp.

§Example
use tessera_ui_basic_components::text_editor::TextEditorArgs;
use tessera_ui::Dp;
let args = TextEditorArgs::simple().with_min_width(Dp(80.0));
Source

pub fn with_min_height(self, min_height: Dp) -> Self

Sets the minimum height in Dp.

§Example
use tessera_ui_basic_components::text_editor::TextEditorArgs;
use tessera_ui::Dp;
let args = TextEditorArgs::simple().with_min_height(Dp(40.0));
Source

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

Sets the background color.

§Example
use tessera_ui_basic_components::text_editor::TextEditorArgs;
use tessera_ui::Color;
let args = TextEditorArgs::simple().with_background_color(Color::WHITE);
Source

pub fn with_border_width(self, width: Dp) -> Self

Sets the border width in pixels.

§Example
use tessera_ui::Dp;
use tessera_ui_basic_components::text_editor::TextEditorArgs;

let args = TextEditorArgs::simple().with_border_width(Dp(1.0));
Source

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

Sets the border color.

§Example
use tessera_ui_basic_components::text_editor::TextEditorArgs;
use tessera_ui::Color;
let args = TextEditorArgs::simple().with_border_color(Color::BLACK);
Source

pub fn with_shape(self, shape: Shape) -> Self

Sets the shape of the editor container.

§Example
use tessera_ui::Dp;
use tessera_ui_basic_components::text_editor::TextEditorArgs;
use tessera_ui_basic_components::shape_def::{RoundedCorner, Shape};
let args = TextEditorArgs::simple().with_shape(Shape::RoundedRectangle {
    top_left: RoundedCorner::manual(Dp(8.0), 3.0),
    top_right: RoundedCorner::manual(Dp(8.0), 3.0),
    bottom_right: RoundedCorner::manual(Dp(8.0), 3.0),
    bottom_left: RoundedCorner::manual(Dp(8.0), 3.0),
});
Source

pub fn with_padding(self, padding: Dp) -> Self

Sets the inner padding in Dp.

§Example
use tessera_ui_basic_components::text_editor::TextEditorArgs;
use tessera_ui::Dp;
let args = TextEditorArgs::simple().with_padding(Dp(12.0));
Source

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

Sets the border color when focused.

§Example
use tessera_ui_basic_components::text_editor::TextEditorArgs;
use tessera_ui::Color;
let args = TextEditorArgs::simple().with_focus_border_color(Color::new(0.0, 0.5, 1.0, 1.0));
Source

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

Sets the background color when focused.

§Example
use tessera_ui_basic_components::text_editor::TextEditorArgs;
use tessera_ui::Color;
let args = TextEditorArgs::simple().with_focus_background_color(Color::WHITE);
Source

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

Sets the selection highlight color.

§Example
use tessera_ui_basic_components::text_editor::TextEditorArgs;
use tessera_ui::Color;
let args = TextEditorArgs::simple().with_selection_color(Color::new(0.5, 0.7, 1.0, 0.4));

Trait Implementations§

Source§

impl Clone for TextEditorArgs

Source§

fn clone(&self) -> TextEditorArgs

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for TextEditorArgs

Source§

fn default() -> Self

Returns the “default value” for a type. 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
§

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

§

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

Returns a reference to the concrete type as &dyn Any.
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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

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

§

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.
§

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.
§

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.
§

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.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> NoneValue for T
where T: Default,

§

type NoneType = T

§

fn null_value() -> T

The none-equivalent value.
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
§

impl<T> Upcast<T> for T

§

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

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

impl<T> ShardState for T
where T: 'static + Send + Sync + Default,

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,