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.

The default is Style::body_text_style (generally TextStyle::Body).

Monospace label with gray background

Extra strong text (stronger color).

Extra weak text (fainter color).

draw a line under the text

draw a line through the text, crossing it out

tilt the characters to the right.

Smaller text

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() {
    /* … */
}

line_color: used for underline and strikethrough, if any.

Read the text style, or get the default for the current style

Trait Implementations

Performs the conversion.

Performs the conversion.

Performs the conversion.

Allocate space, interact, paint, and return a Response. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.