pub struct IconButton<'a> { /* private fields */ }Expand description
Icon Button component
size controls the total widget size (allocation), not the icon drawing area.
The icon is drawn inside after subtracting padding.
For Ghost/Link variants, padding defaults to 0 so size ≈ icon size.
For other variants, padding defaults to ui.spacing().button_padding.
Implementations§
Source§impl<'a> IconButton<'a>
impl<'a> IconButton<'a>
Sourcepub const fn new(icon_data: &'a IconData) -> Self
pub const fn new(icon_data: &'a IconData) -> Self
Create a new icon button from static IconData.
Sourcepub fn from_owned(data: &'a OwnedIconData) -> Self
pub fn from_owned(data: &'a OwnedIconData) -> Self
Create a new icon button from OwnedIconData.
Sourcepub const fn variant(self, variant: ButtonVariant) -> Self
pub const fn variant(self, variant: ButtonVariant) -> Self
Set the button variant
Sourcepub const fn size(self, size: f32) -> Self
pub const fn size(self, size: f32) -> Self
Set the total widget size (icon + padding). Default 16.
Sourcepub const fn padding(self, padding: f32) -> Self
pub const fn padding(self, padding: f32) -> Self
Set padding between widget edge and icon. Default: 0 for Ghost/Link, button_padding for others.
Sourcepub const fn icon_color(self, color: Color32) -> Self
pub const fn icon_color(self, color: Color32) -> Self
Set custom icon color (overrides default)
Sourcepub const fn hover_icon_color(self, color: Color32) -> Self
pub const fn hover_icon_color(self, color: Color32) -> Self
Set custom hover icon color (overrides default)
Auto Trait Implementations§
impl<'a> Freeze for IconButton<'a>
impl<'a> RefUnwindSafe for IconButton<'a>
impl<'a> Send for IconButton<'a>
impl<'a> Sync for IconButton<'a>
impl<'a> Unpin for IconButton<'a>
impl<'a> UnsafeUnpin for IconButton<'a>
impl<'a> UnwindSafe for IconButton<'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