pub struct ButtonProps {
pub variant: ButtonVariant,
pub size: ButtonSize,
pub disabled: bool,
pub loading: bool,
pub button_type: Option<String>,
pub class: Option<String>,
pub style: Option<String>,
pub on_click: Option<Callback<MouseEvent>>,
pub on_focus: Option<Callback<FocusEvent>>,
pub on_blur: Option<Callback<FocusEvent>>,
pub children: Box<dyn FnOnce() -> AnyView + Send>,
}Expand description
Props for the Button component.
Button component with accessibility and variant support
§Required Props
- children:
Children- Child content
§Optional Props
- variant:
ButtonVariant- Button styling variant
- size:
ButtonSize- Button size
- disabled:
bool- Whether the button is disabled
- loading:
bool- Whether the button is in a loading state
- button_type:
impl Into<String>- Button type attribute (button, submit, reset)
- class:
String- CSS classes
- style:
String- CSS styles
- on_click:
Callback<web_sys::MouseEvent>- Click event handler
- on_focus:
Callback<web_sys::FocusEvent>- Focus event handler
- on_blur:
Callback<web_sys::FocusEvent>- Blur event handler
Fields§
§variant: ButtonVariantButton styling variant
size: ButtonSizeButton size
disabled: boolWhether the button is disabled
loading: boolWhether the button is in a loading state
Button type attribute (button, submit, reset)
class: Option<String>CSS classes
style: Option<String>CSS styles
on_click: Option<Callback<MouseEvent>>Click event handler
on_focus: Option<Callback<FocusEvent>>Focus event handler
on_blur: Option<Callback<FocusEvent>>Blur event handler
children: Box<dyn FnOnce() -> AnyView + Send>Child content
Implementations§
Source§impl ButtonProps
impl ButtonProps
Sourcepub fn builder() -> ButtonPropsBuilder
pub fn builder() -> ButtonPropsBuilder
Create a builder for building ButtonProps.
On the builder, call .variant(...)(optional), .size(...)(optional), .disabled(...)(optional), .loading(...)(optional), .button_type(...)(optional), .class(...)(optional), .style(...)(optional), .on_click(...)(optional), .on_focus(...)(optional), .on_blur(...)(optional), .children(...) to set the values of the fields.
Finally, call .build() to create the instance of ButtonProps.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ButtonProps
impl !RefUnwindSafe for ButtonProps
impl Send for ButtonProps
impl !Sync for ButtonProps
impl Unpin for ButtonProps
impl !UnwindSafe for ButtonProps
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> SerializableKey for T
impl<T> SerializableKey for T
Source§impl<T> StorageAccess<T> for T
impl<T> StorageAccess<T> for T
Source§fn as_borrowed(&self) -> &T
fn as_borrowed(&self) -> &T
Borrows the value.
Source§fn into_taken(self) -> T
fn into_taken(self) -> T
Takes the value.