pub struct MaterialIconButton<'a> { /* private fields */ }Expand description
Material Design icon button component.
Icon buttons help users take supplementary actions with a single tap. They’re used when a compact button is required.
§Example
// Standard icon button
if ui.add(MaterialIconButton::standard("favorite")).clicked() {
println!("Favorite clicked!");
}
// Filled icon button with toggle state
let mut liked = false;
ui.add(MaterialIconButton::filled("favorite")
.toggle(&mut liked)
.size(48.0));Implementations§
Source§impl<'a> MaterialIconButton<'a>
impl<'a> MaterialIconButton<'a>
Sourcepub fn new(icon: impl Into<String>, variant: IconButtonVariant) -> Self
pub fn new(icon: impl Into<String>, variant: IconButtonVariant) -> Self
Sourcepub fn filled_tonal(icon: impl Into<String>) -> Self
pub fn filled_tonal(icon: impl Into<String>) -> Self
Sourcepub fn svg(self, path: impl Into<String>) -> Self
pub fn svg(self, path: impl Into<String>) -> Self
Use an SVG file as the icon. The path will be loaded and rasterized.
Sourcepub fn svg_data(self, svg_content: impl Into<String>) -> Self
pub fn svg_data(self, svg_content: impl Into<String>) -> Self
Use inline SVG content as the icon. The content will be rasterized directly.
Sourcepub fn icon_color(self, color: Color32) -> Self
pub fn icon_color(self, color: Color32) -> Self
Override the icon color.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for MaterialIconButton<'a>
impl<'a> !RefUnwindSafe for MaterialIconButton<'a>
impl<'a> !Send for MaterialIconButton<'a>
impl<'a> !Sync for MaterialIconButton<'a>
impl<'a> Unpin for MaterialIconButton<'a>
impl<'a> UnsafeUnpin for MaterialIconButton<'a>
impl<'a> !UnwindSafe for MaterialIconButton<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.