pub struct ButtonView<State: 'static> { /* private fields */ }Expand description
A declarative pressable button. See the module docs.
Implementations§
Source§impl<State: 'static> ButtonView<State>
impl<State: 'static> ButtonView<State>
Sourcepub fn style(self, style: ButtonStyle) -> Self
pub fn style(self, style: ButtonStyle) -> Self
Select the visual style (default ButtonStyle::Primary).
Sourcepub fn loading(self, loading: bool) -> Self
pub fn loading(self, loading: bool) -> Self
Show a loading spinner in place of the label while loading is
true, suppressing on_press and reporting disabled semantics for as
long as it’s shown.
Sourcepub fn disabled(self, disabled: bool) -> Self
pub fn disabled(self, disabled: bool) -> Self
Disable the button while disabled is true, suppressing on_press,
blocking focus acquisition, and dimming the appearance (fill, border,
label) by multiplying their alpha by [DISABLED_ALPHA]. Precedence:
if both .disabled(true) and .loading(true), disabled takes effect
(both suppress interaction and report disabled semantics anyway).
Sourcepub fn label_alignment(self, alignment: Alignment) -> Self
pub fn label_alignment(self, alignment: Alignment) -> Self
Explicitly position the label within a stretched button, overriding
the stretch-aware default on both axes — see the module
docs’s “Label alignment” section. Ignored under
ButtonStyle::Icon, which is always centered.
Trait Implementations§
Source§impl<State: 'static> View<State> for ButtonView<State>
impl<State: 'static> View<State> for ButtonView<State>
Source§type Element = ButtonWidget
type Element = ButtonWidget
Source§fn build(&self, ctx: &mut BuildCtx<'_>) -> ButtonWidget
fn build(&self, ctx: &mut BuildCtx<'_>) -> ButtonWidget
Source§fn rebuild(
&self,
prev: &Self,
element: &mut ButtonWidget,
ctx: &mut BuildCtx<'_>,
) -> ChangeFlags
fn rebuild( &self, prev: &Self, element: &mut ButtonWidget, ctx: &mut BuildCtx<'_>, ) -> ChangeFlags
prev (the previous view of the same type) against the live
element, mutating it in place and reporting what changed.