Struct egui::widgets::Label [−][src]
pub struct Label { /* fields omitted */ }
Expand description
Static text.
ui.label("Equivalent");
ui.add(egui::Label::new("Equivalent"));
ui.add(egui::Label::new("With Options").text_color(egui::Color32::RED));
Implementations
If true
, the text will wrap at the max_width
.
By default Self::wrap
will be true in vertical layouts
and horizontal layouts with wrapping,
and false on non-wrapping horizontal layouts.
Note that any \n
in the text label will always produce a new line.
Use Label::wrap instead
The default is Style::body_text_style
(generally TextStyle::Body
).
draw a line through the text, crossing it out
For e.g. exponents
Align text to top. Only applicable together with Self::small()
.
Fill-color behind the text
Make the label respond to clicks and/or drags.
By default, a label is inert and does not respond to click or drags. By calling this you can turn the label into a button of sorts. This will also give the label the hover-effect of a button, but without the frame.
if ui.add(Label::new("click me").sense(Sense::click())).clicked() {
/* … */
}
Read the text style, or get the default for the current style