pub struct TextElement {Show 17 fields
pub content: String,
pub font_size: Option<f64>,
pub font_weight: Option<FontWeight>,
pub font_design: Option<FontDesign>,
pub text_style: Option<TextStyle>,
pub color: Option<ColorValue>,
pub alignment: Option<TextAlignment>,
pub line_limit: Option<u32>,
pub truncation_mode: Option<TruncationMode>,
pub minimum_scale_factor: Option<f64>,
pub line_height: Option<f64>,
pub letter_spacing: Option<f64>,
pub underline: Option<bool>,
pub strikethrough: Option<bool>,
pub italic: Option<bool>,
pub monospaced_digit: Option<bool>,
pub style: ElementStyle,
}Expand description
Text label with optional semantic typography.
Fields§
§content: StringString to display.
font_size: Option<f64>Font size in points (overridden by textStyle when set).
font_weight: Option<FontWeight>Font weight.
font_design: Option<FontDesign>Font design (default, monospaced, rounded, serif).
text_style: Option<TextStyle>Semantic text style (uses Dynamic Type on Apple, sp on Android).
Overrides fontSize when set.
color: Option<ColorValue>Text color.
alignment: Option<TextAlignment>Text alignment within the line.
line_limit: Option<u32>Maximum number of lines before truncation.
truncation_mode: Option<TruncationMode>Where text is cut when it does not fit. Default tail.
minimum_scale_factor: Option<f64>Allow shrinking the font down to this factor (0.5 = half) before truncating.
line_height: Option<f64>Line height in points.
letter_spacing: Option<f64>Extra space between characters in points.
underline: Option<bool>Underline the text.
strikethrough: Option<bool>Strike the text through.
italic: Option<bool>Italic.
monospaced_digit: Option<bool>Equal-width digits (counters, prices) without a monospaced font.
style: ElementStyleShared visual style (padding, background, frame, …).
Implementations§
Source§impl TextElement
impl TextElement
Sourcepub fn font_size(self, size: f64) -> Self
pub fn font_size(self, size: f64) -> Self
Set explicit point size (ignored when text_style is set).
Sourcepub fn font_weight(self, weight: FontWeight) -> Self
pub fn font_weight(self, weight: FontWeight) -> Self
Set font weight.
Sourcepub fn color(self, color: impl Into<ColorValue>) -> Self
pub fn color(self, color: impl Into<ColorValue>) -> Self
Set text color.
Trait Implementations§
Source§impl Clone for TextElement
impl Clone for TextElement
Source§impl Debug for TextElement
impl Debug for TextElement
Source§impl Default for TextElement
impl Default for TextElement
Source§impl<'de> Deserialize<'de> for TextElement
impl<'de> Deserialize<'de> for TextElement
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<TextElement> for WidgetElement
impl From<TextElement> for WidgetElement
Source§fn from(value: TextElement) -> Self
fn from(value: TextElement) -> Self
Source§impl JsonSchema for TextElement
Available on crate feature schema only.
impl JsonSchema for TextElement
schema only.Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref keyword. Read more