pub struct Label { /* private fields */ }
Expand description

Static text.

Usually it is more convenient to use Ui::label.

ui.label("Equivalent");
ui.add(egui::Label::new("Equivalent"));
ui.add(egui::Label::new("With Options").wrap(false));
ui.label(egui::RichText::new("With formatting").underline());

Implementations

If true, the text will wrap to stay within the max width of the Ui.

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 will always produce a new line.

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

Do layout and position the galley in the ui, without painting it or adding widget info.

Trait Implementations

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
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.