pub struct LabelProps {
pub text: String,
pub font: FontSpec,
pub color: Option<Color>,
pub role: TextRole,
pub wraps: bool,
pub max_lines: u32,
pub align: TextAlign,
pub runs: Vec<TextRun>,
}Fields§
§text: String§font: FontSpec§color: Option<Color>§role: TextRoleWhat the text means, for the color the platform gives it (docs/text.md).
Semantic the way crate::Font is semantic: an app says “this is secondary text”
and each platform answers with its own answer: secondaryLabelColor on Apple,
?android:textColorSecondary, GTK’s dim-label. That is the only way a de-emphasized
label stays correct in both appearances, since a literal grey that reads well on white
is wrong on black. An explicit Self::color still wins; a backend that has no such
color renders primary, which is legible and correct, just not dimmed.
wraps: bool§max_lines: u32Maximum rendered lines; zero is unlimited. Native Apple plain labels truncate the last line. Other backends may retain their ordinary wrapping behavior.
align: TextAlignHow the label’s lines sit within its own width. Only observable on a label that wraps or carries explicit newlines: a single line fills its box, so its alignment is the container’s business, not the label’s.
Leading is the default and is what running text wants; Center is for the short,
centered block a welcome screen or an empty state uses. A backend that cannot set
it renders leading-aligned, which is legible and correct, just not centered.
runs: Vec<TextRun>Styled spans within text (docs/text-runs.md). Empty is the overwhelmingly common
case and means exactly what a label has always meant: one font, one color. A backend
that cannot draw runs ignores this and renders text uniformly, which is legible and
correct, just unstyled.
Trait Implementations§
Source§impl Clone for LabelProps
impl Clone for LabelProps
Source§fn clone(&self) -> LabelProps
fn clone(&self) -> LabelProps
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more