#[must_use]
pub struct Label {
pub(crate) text: String,
pub(crate) muted: bool,
pub(crate) size: Option<crate::tokens::component_size::ComponentSize>,
pub(crate) wrap: Option<crate::text::Wrap>,
}
impl Label {
pub fn new(text: impl Into<String>) -> Self {
Self {
text: text.into(),
muted: false,
size: None,
wrap: None,
}
}
pub fn muted(mut self) -> Self {
self.muted = true;
self
}
pub fn size(mut self, size: crate::tokens::component_size::ComponentSize) -> Self {
self.size = Some(size);
self
}
pub fn wrap(mut self, wrap: crate::text::Wrap) -> Self {
self.wrap = Some(wrap);
self
}
pub fn show(self, ui: &mut egui::Ui) -> egui::Response {
ui.add(self)
}
}