pub struct Text(/* private fields */);Expand description
Static or reactive text.
Implementations§
Source§impl Text
impl Text
pub fn new(text: impl IntoValue<String>) -> Text
pub fn text_style(self, style: impl IntoValue<TextStyle>) -> Text
Sourcepub fn max_lines(self, lines: impl IntoValue<u32>) -> Text
pub fn max_lines(self, lines: impl IntoValue<u32>) -> Text
Shows at most this many lines, the last one cut off with an ellipsis where the text goes on, as the platform draws one; 0 shows them all. It’s still read out in full.
Sourcepub fn truncation(self, truncation: impl IntoValue<Truncation>) -> Text
pub fn truncation(self, truncation: impl IntoValue<Truncation>) -> Text
Where the ellipsis goes when it’s cut off at max_lines: in place
of its start, its middle (to keep a path’s file name, say) or its
end, the default. AppKit, Qt and WinUI cut off a single line’s
start or middle only, and the end of more lines, as their own
labels do. A selectable label on WinUI or KDE cuts off its end.
Sourcepub fn color(self, color: impl IntoValue<Color>) -> Text
pub fn color(self, color: impl IntoValue<Color>) -> Text
Its colour. A semantic one (Color::SecondaryLabel, Color::Error,
…) is the platform’s own, and follows dark mode and high contrast;
Color::Rgba is fixed, whatever the appearance.
Sourcepub fn weight(self, weight: impl IntoValue<FontWeight>) -> Text
pub fn weight(self, weight: impl IntoValue<FontWeight>) -> Text
Its weight, in place of its text style’s. A platform whose font lacks one uses the nearest it has.
pub fn italic(self, italic: impl IntoValue<bool>) -> Text
Sourcepub fn text_align(self, align: impl IntoValue<TextAlign>) -> Text
pub fn text_align(self, align: impl IntoValue<TextAlign>) -> Text
Where its lines go across its frame: Start and End follow its
direction (TextDirection). Like CSS’s text-align, it shows only
where the frame is wider than the text, e.g. stretched across a
column, or wrapping.
Sourcepub fn selectable(self, selectable: bool) -> Text
pub fn selectable(self, selectable: bool) -> Text
Its text can be selected and copied, as the platform’s selectable
labels are (Kirigami’s SelectableLabel on KDE). Fixed when it’s
built: on KDE a selectable label is another item.
Trait Implementations§
Source§impl ElementBuilder for Text
impl ElementBuilder for Text
fn element(&mut self) -> &mut Element
Source§fn style(self, f: impl FnOnce(&mut Style)) -> Self
fn style(self, f: impl FnOnce(&mut Style)) -> Self
Source§fn style_with(self, f: impl Fn(&mut Style) + 'static) -> Self
fn style_with(self, f: impl Fn(&mut Style) + 'static) -> Self
f re-runs whenever the
signals it reads change, and must set every field it cares about.fn width(self, value: impl IntoValue<Length>) -> Self
fn height(self, value: impl IntoValue<Length>) -> Self
fn min_width(self, value: impl IntoValue<Length>) -> Self
fn min_height(self, value: impl IntoValue<Length>) -> Self
fn max_width(self, value: impl IntoValue<Length>) -> Self
fn max_height(self, value: impl IntoValue<Length>) -> Self
fn aspect_ratio(self, value: impl IntoValue<f32>) -> Self
fn padding(self, value: impl IntoValue<Length>) -> Self
fn padding_x(self, value: impl IntoValue<Length>) -> Self
fn padding_y(self, value: impl IntoValue<Length>) -> Self
fn padding_start(self, value: impl IntoValue<Length>) -> Self
fn padding_end(self, value: impl IntoValue<Length>) -> Self
fn padding_top(self, value: impl IntoValue<Length>) -> Self
fn padding_bottom(self, value: impl IntoValue<Length>) -> Self
fn margin(self, value: impl IntoValue<Length>) -> Self
fn margin_x(self, value: impl IntoValue<Length>) -> Self
fn margin_y(self, value: impl IntoValue<Length>) -> Self
fn margin_start(self, value: impl IntoValue<Length>) -> Self
fn margin_end(self, value: impl IntoValue<Length>) -> Self
fn margin_top(self, value: impl IntoValue<Length>) -> Self
fn margin_bottom(self, value: impl IntoValue<Length>) -> Self
fn grow(self, value: impl IntoValue<f32>) -> Self
fn shrink(self, value: impl IntoValue<f32>) -> Self
fn basis(self, value: impl IntoValue<Length>) -> Self
fn align_self(self, value: impl IntoValue<Align>) -> Self
Source§fn justify_self(self, value: impl IntoValue<Align>) -> Self
fn justify_self(self, value: impl IntoValue<Align>) -> Self
Source§fn top(self, value: impl IntoValue<Length>) -> Self
fn top(self, value: impl IntoValue<Length>) -> Self
absolute()).fn bottom(self, value: impl IntoValue<Length>) -> Self
Source§fn start(self, value: impl IntoValue<Length>) -> Self
fn start(self, value: impl IntoValue<Length>) -> Self
fn end(self, value: impl IntoValue<Length>) -> Self
fn grid_column(self, value: impl IntoValue<GridPlacement>) -> Self
fn grid_row(self, value: impl IntoValue<GridPlacement>) -> Self
fn direction(self, value: impl IntoValue<TextDirection>) -> Self
display the node had.fn size( self, width: impl IntoValue<Length>, height: impl IntoValue<Length>, ) -> Self
Source§fn tooltip(self, text: impl IntoValue<String>) -> Self
fn tooltip(self, text: impl IntoValue<String>) -> Self
entries, and built again whenever what it
reads changes, as Menu::children_with builds its entries.