pub struct ButtonProps {Show 28 fields
pub type: ButtonType,
pub size: ButtonSize,
pub shape: ButtonShape,
pub danger: bool,
pub ghost: bool,
pub block: bool,
pub loading: bool,
pub loading_delay: Option<u64>,
pub loading_icon: Option<Element>,
pub auto_insert_space: bool,
pub label: Option<String>,
pub icon_only: Option<bool>,
pub disabled: bool,
pub color: Option<ButtonColor>,
pub variant: Option<ButtonVariant>,
pub icon_placement: ButtonIconPlacement,
pub icon_position: Option<ButtonIconPlacement>,
pub icon: Option<Element>,
pub href: Option<String>,
pub class: Option<String>,
pub class_names_root: Option<String>,
pub class_names_icon: Option<String>,
pub class_names_content: Option<String>,
pub styles_root: Option<String>,
pub html_type: ButtonHtmlType,
pub data_attributes: Option<Vec<(String, String)>>,
pub onclick: Option<EventHandler<MouseEvent>>,
pub children: Element,
}Expand description
Props for the Ant Design flavored button.
Note: The loading property in Ant Design TypeScript supports an object form
{ delay?: number, icon?: ReactNode }. In this Rust implementation, it is split
into loading (boolean), loading_delay (Optionloading_icon (Option
Fields§
§type: ButtonType§size: ButtonSize§shape: ButtonShape§danger: bool§ghost: bool§block: bool§loading: boolWhether the button is in loading state.
Note: In Ant Design TypeScript, this can be a boolean or an object { delay?: number, icon?: ReactNode }.
Here it is split into loading, loading_delay, and loading_icon for better type safety.
loading_delay: Option<u64>Optional loading delay in milliseconds before showing spinner.
loading_icon: Option<Element>Custom loading icon.
auto_insert_space: boolIf true, inserts a space between two CJK chars (antd behavior).
label: Option<String>Optional label text used for auto spacing/icon-only detection; if set, overrides children text for button content.
icon_only: Option<bool>Mark as icon-only (adds class); if unset, derives from label being empty with an icon.
disabled: bool§color: Option<ButtonColor>§variant: Option<ButtonVariant>§icon_placement: ButtonIconPlacementIcon placement relative to content.
icon_position: Option<ButtonIconPlacement>@deprecated Please use icon_placement instead.
This property is kept for backward compatibility and will be mapped to icon_placement.
icon: Option<Element>§href: Option<String>§class: Option<String>§class_names_root: Option<String>Extra class applied to button element (aligned to antd classNames.root).
class_names_icon: Option<String>Extra class applied to icon span.
class_names_content: Option<String>Extra class applied to content span.
styles_root: Option<String>Extra inline style applied to root.
html_type: ButtonHtmlTypeNative button type, used when rendering as <button>.
data_attributes: Option<Vec<(String, String)>>Data attributes as a map of key-value pairs. Keys should be without the “data-” prefix.
For example, data_attributes: Some([("test", "value")]) will render as data-test="value".
onclick: Option<EventHandler<MouseEvent>>§children: ElementImplementations§
Source§impl ButtonProps
impl ButtonProps
Sourcepub fn builder() -> ButtonPropsBuilder<((), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), ())>
pub fn builder() -> ButtonPropsBuilder<((), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), ())>
Create a builder for building ButtonProps.
On the builder, call .r#type(...)(optional), .size(...)(optional), .shape(...)(optional), .danger(...)(optional), .ghost(...)(optional), .block(...)(optional), .loading(...)(optional), .loading_delay(...)(optional), .loading_icon(...)(optional), .auto_insert_space(...)(optional), .label(...)(optional), .icon_only(...)(optional), .disabled(...)(optional), .color(...)(optional), .variant(...)(optional), .icon_placement(...)(optional), .icon_position(...)(optional), .icon(...)(optional), .href(...)(optional), .class(...)(optional), .class_names_root(...)(optional), .class_names_icon(...)(optional), .class_names_content(...)(optional), .styles_root(...)(optional), .html_type(...)(optional), .data_attributes(...)(optional), .onclick(...)(optional), .children(...)(optional) to set the values of the fields.
Finally, call .build() to create the instance of ButtonProps.
Trait Implementations§
Source§impl Clone for ButtonProps
impl Clone for ButtonProps
Source§fn clone(&self) -> ButtonProps
fn clone(&self) -> ButtonProps
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more