pub struct Button { /* private fields */ }Expand description
A coloured, rounded button.
if ui.add(Button::new("Save").accent(Accent::Green)).clicked() {
// ...
}Implementations§
Source§impl Button
impl Button
Sourcepub fn new(text: impl Into<WidgetText>) -> Self
pub fn new(text: impl Into<WidgetText>) -> Self
Create a new button. Defaults to the Blue accent and medium size.
Sourcepub fn accent(self, accent: Accent) -> Self
pub fn accent(self, accent: Accent) -> Self
Pick the button accent colour. Ignored when the button is set to
Button::outline, which has no fill colour of its own.
Sourcepub fn outline(self) -> Self
pub fn outline(self) -> Self
Render the button as a transparent, bordered “ghost” treatment for secondary actions.
Sourcepub fn size(self, size: ButtonSize) -> Self
pub fn size(self, size: ButtonSize) -> Self
Pick a size preset.
Sourcepub fn min_width(self, w: f32) -> Self
pub fn min_width(self, w: f32) -> Self
Set a minimum width (in points). Useful to line up button groups.
Sourcepub fn full_width(self) -> Self
pub fn full_width(self) -> Self
Stretch to fill the available horizontal space.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Button
impl RefUnwindSafe for Button
impl Send for Button
impl Sync for Button
impl Unpin for Button
impl UnsafeUnpin for Button
impl UnwindSafe for Button
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